package loggers
import "github.com/gohugoio/hugo/common/loggers"
package loggers contains some basic logging setup.
Index ¶
- Variables
- func InitGlobalLogger(panicOnWarnings bool)
- func LevelLoggerToWriter(l logg.LevelLogger) io.Writer
- type Logger
- type Options
Variables ¶
var ( // FieldNameCmd is the name of the field that holds the command name. FieldNameCmd = reservedFieldNamePrefix + "_cmd" // Used to suppress statements. FieldNameStatementID = reservedFieldNamePrefix + "__h_field_statement_id" )
var PanicOnWarningHook = func(e *logg.Entry) error { if e.Level != logg.LevelWarn { return nil } panic(e.Message) }
PanicOnWarningHook panics on warnings.
Functions ¶
func InitGlobalLogger ¶
func InitGlobalLogger(panicOnWarnings bool)
func LevelLoggerToWriter ¶
func LevelLoggerToWriter(l logg.LevelLogger) io.Writer
Types ¶
type Logger ¶
type Logger interface { Debugf(format string, v ...any) Debugln(v ...any) Error() logg.LevelLogger Errorf(format string, v ...any) Errorln(v ...any) Errors() string Errorsf(id, format string, v ...any) Info() logg.LevelLogger InfoCommand(command string) logg.LevelLogger Infof(format string, v ...any) Infoln(v ...any) Level() logg.Level LoggCount(logg.Level) int Logger() logg.Logger Out() io.Writer Printf(format string, v ...any) Println(v ...any) PrintTimerIfDelayed(start time.Time, name string) Reset() Warn() logg.LevelLogger WarnCommand(command string) logg.LevelLogger Warnf(format string, v ...any) Warnln(v ...any) Deprecatef(fail bool, format string, v ...any) }
func Log ¶
func Log() Logger
func New ¶
New creates a new logger with the given options.
func NewDefault ¶
func NewDefault() Logger
NewDefault creates a new logger with the default options.
type Options ¶
type Options struct { Level logg.Level Stdout io.Writer Stderr io.Writer Distinct bool StoreErrors bool HandlerPost func(e *logg.Entry) error SuppressStatements map[string]bool }
Options defines options for the logger.
Source Files ¶
handlerdefault.go handlersmisc.go handlerterminal.go logger.go loggerglobal.go
- Version
- v0.118.2
- Published
- Aug 31, 2023
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 2 hours ago –
Tools for package owners.