logutils

package
v1.50.1-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugKeyAutogenExclude     = "autogen_exclude"
	DebugKeyBinSalt            = "bin_salt"
	DebugKeyConfigReader       = "config_reader"
	DebugKeyEmpty              = ""
	DebugKeyEnabledLinters     = "enabled_linters"
	DebugKeyEnv                = "env"
	DebugKeyExcludeRules       = "exclude_rules"
	DebugKeyExec               = "exec"
	DebugKeyFilenameUnadjuster = "filename_unadjuster"
	DebugKeyGoEnv              = "goenv"
	DebugKeyLinter             = "linter"
	DebugKeyLintersContext     = "linters_context"
	DebugKeyLintersDB          = "lintersdb"
	DebugKeyLintersOutput      = "linters_output"
	DebugKeyLoader             = "loader"
	DebugKeyMaxFromLinter      = "max_from_linter"
	DebugKeyMaxSameIssues      = "max_same_issues"
	DebugKeyPkgCache           = "pkgcache"
	DebugKeyRunner             = "runner"
	DebugKeySeverityRules      = "severity_rules"
	DebugKeySkipDirs           = "skip_dirs"
	DebugKeySourceCode         = "source_code"
	DebugKeyStopwatch          = "stopwatch"
	DebugKeyTabPrinter         = "tab_printer"
	DebugKeyTest               = "test"
	DebugKeyTextPrinter        = "text_printer"
)
View Source
const (
	DebugKeyGoAnalysis = "goanalysis"

	DebugKeyGoAnalysisAnalyze     = DebugKeyGoAnalysis + "/analyze"
	DebugKeyGoAnalysisIssuesCache = DebugKeyGoAnalysis + "/issues/cache"
	DebugKeyGoAnalysisMemory      = DebugKeyGoAnalysis + "/memory"

	DebugKeyGoAnalysisFacts        = DebugKeyGoAnalysis + "/facts"
	DebugKeyGoAnalysisFactsCache   = DebugKeyGoAnalysisFacts + "/cache"
	DebugKeyGoAnalysisFactsExport  = DebugKeyGoAnalysisFacts + "/export"
	DebugKeyGoAnalysisFactsInherit = DebugKeyGoAnalysisFacts + "/inherit"
)
View Source
const (
	DebugKeyGoCritic  = "gocritic"
	DebugKeyMegacheck = "megacheck"
	DebugKeyNolint    = "nolint"
	DebugKeyRevive    = "revive"
)

Variables

Functions

func HaveDebugTag

func HaveDebugTag(tag string) bool

func SetupVerboseLog

func SetupVerboseLog(log Log, isVerbose bool)

Types

type DebugFunc

type DebugFunc func(format string, args ...interface{})

func Debug

func Debug(tag string) DebugFunc

type Log

type Log interface {
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Infof(format string, args ...interface{})

	Child(name string) Log
	SetLevel(level LogLevel)
}

type LogLevel

type LogLevel int
const (
	// LogLevelDebug Debug messages, write to debug logs only by logutils.Debug.
	LogLevelDebug LogLevel = 0

	// LogLevelInfo Information messages, don't write too many messages,
	// only useful ones: they are shown when running with -v.
	LogLevelInfo LogLevel = 1

	// LogLevelWarn Hidden errors: non-critical errors: work can be continued, no need to fail whole program;
	// tests will crash if any warning occurred.
	LogLevelWarn LogLevel = 2

	// LogLevelError Only not hidden from user errors: whole program failing, usually
	// error logging happens in 1-2 places: in the "main" function.
	LogLevelError LogLevel = 3
)

type MockLog

type MockLog struct {
	mock.Mock
}

func NewMockLog

func NewMockLog() *MockLog

func (*MockLog) Child

func (m *MockLog) Child(name string) Log

func (*MockLog) Errorf

func (m *MockLog) Errorf(format string, args ...interface{})

func (*MockLog) Fatalf

func (m *MockLog) Fatalf(format string, args ...interface{})

func (*MockLog) Infof

func (m *MockLog) Infof(format string, args ...interface{})

func (*MockLog) Panicf

func (m *MockLog) Panicf(format string, args ...interface{})

func (*MockLog) SetLevel

func (m *MockLog) SetLevel(level LogLevel)

func (*MockLog) Warnf

func (m *MockLog) Warnf(format string, args ...interface{})

type StderrLog

type StderrLog struct {
	// contains filtered or unexported fields
}

func NewStderrLog

func NewStderrLog(name string) *StderrLog

func (StderrLog) Child

func (sl StderrLog) Child(name string) Log

func (StderrLog) Debugf

func (sl StderrLog) Debugf(format string, args ...interface{})

func (StderrLog) Errorf

func (sl StderrLog) Errorf(format string, args ...interface{})

func (StderrLog) Fatalf

func (sl StderrLog) Fatalf(format string, args ...interface{})

func (StderrLog) Infof

func (sl StderrLog) Infof(format string, args ...interface{})

func (StderrLog) Panicf

func (sl StderrLog) Panicf(format string, args ...interface{})

func (*StderrLog) SetLevel

func (sl *StderrLog) SetLevel(level LogLevel)

func (StderrLog) Warnf

func (sl StderrLog) Warnf(format string, args ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL