logutils

package
v1.54.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 9 Imported by: 97

Documentation

Index

Constants

View Source
const (
	DebugKeyAutogenExclude     = "autogen_exclude" // Debugs a filter excluding autogenerated source code.
	DebugKeyBinSalt            = "bin_salt"
	DebugKeyConfigReader       = "config_reader"
	DebugKeyEmpty              = ""
	DebugKeyEnabledLinters     = "enabled_linters"
	DebugKeyEnv                = "env" // Debugs `go env` command.
	DebugKeyExcludeRules       = "exclude_rules"
	DebugKeyExec               = "exec"
	DebugKeyFilenameUnadjuster = "filename_unadjuster"
	DebugKeyForbidigo          = "forbidigo"
	DebugKeyGoEnv              = "goenv"
	DebugKeyLinter             = "linter"
	DebugKeyLintersContext     = "linters_context"
	DebugKeyLintersDB          = "lintersdb"
	DebugKeyLintersOutput      = "linters_output"
	DebugKeyLoader             = "loader" // Debugs packages loading (including `go/packages` internal debugging).
	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"  // Debugs `go-critic` linter.
	DebugKeyMegacheck = "megacheck" // Debugs `staticcheck` related linters.
	DebugKeyNolint    = "nolint"    // Debugs a filter excluding issues by `//nolint` comments.
	DebugKeyRevive    = "revive"    // Debugs `revice` linter.
)

Variables

Functions

func HaveDebugTag added in v1.7.1

func HaveDebugTag(tag string) bool

func SetupVerboseLog added in v1.7.1

func SetupVerboseLog(log Log, isVerbose bool)

Types

type DebugFunc added in v1.7.1

type DebugFunc func(format string, args ...any)

func Debug added in v1.7.1

func Debug(tag string) DebugFunc

type Log added in v1.7.1

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

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

type LogLevel added in v1.7.1

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 added in v1.10.2

type MockLog struct {
	mock.Mock
}

func NewMockLog added in v1.10.2

func NewMockLog() *MockLog

func (*MockLog) Child added in v1.10.2

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

func (*MockLog) Errorf added in v1.10.2

func (m *MockLog) Errorf(format string, args ...any)

func (*MockLog) Fatalf added in v1.10.2

func (m *MockLog) Fatalf(format string, args ...any)

func (*MockLog) Infof added in v1.10.2

func (m *MockLog) Infof(format string, args ...any)

func (*MockLog) Panicf added in v1.19.1

func (m *MockLog) Panicf(format string, args ...any)

func (*MockLog) SetLevel added in v1.10.2

func (m *MockLog) SetLevel(level LogLevel)

func (*MockLog) Warnf added in v1.10.2

func (m *MockLog) Warnf(format string, args ...any)

type StderrLog added in v1.7.1

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

func NewStderrLog added in v1.7.1

func NewStderrLog(name string) *StderrLog

func (StderrLog) Child added in v1.7.1

func (sl StderrLog) Child(name string) Log

func (StderrLog) Debugf added in v1.7.1

func (sl StderrLog) Debugf(format string, args ...any)

func (StderrLog) Errorf added in v1.7.1

func (sl StderrLog) Errorf(format string, args ...any)

func (StderrLog) Fatalf added in v1.7.1

func (sl StderrLog) Fatalf(format string, args ...any)

func (StderrLog) Infof added in v1.7.1

func (sl StderrLog) Infof(format string, args ...any)

func (StderrLog) Panicf added in v1.19.0

func (sl StderrLog) Panicf(format string, args ...any)

func (*StderrLog) SetLevel added in v1.7.1

func (sl *StderrLog) SetLevel(level LogLevel)

func (StderrLog) Warnf added in v1.7.1

func (sl StderrLog) Warnf(format string, args ...any)

Jump to

Keyboard shortcuts

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