Documentation ¶
Overview ¶
Package logificial is an opinionated wrapped logger around zap and logrus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // LogLib the underlying library to use to construct the Log Printer LogLib LogLibrary `json:"log_lib"` // Level is Log level // default Info (Development default is debug) Level Level `json:"level"` // EnableCaller to show caller in Log message // default true EnableCaller bool `json:"enable_caller"` // Development represents Logging Mode // default is false Development bool `json:"development"` // OutputPath or file paths to write logging output to. // Default to "stdout" and also in Development mode, // it gets overridden to stdout. OutputPath string `json:"output_path"` }
Config offers a declarative way to construct a Log Printer. Note that Config intentionally supports only the most common options that is supported by both logrus and zap.
type Level ¶
type Level string
Level is a logging priority.
const ( // DebugLevel has verbose message DebugLevel Level = "debug" // InfoLevel is default Log level InfoLevel Level = "info" // WarnLevel is for logging messages about possible issues WarnLevel Level = "warn" // ErrorLevel is for logging errors ErrorLevel Level = "error" // FatalLevel is for logging fatal messages. // The system shutdown after logging the message. FatalLevel Level = "fatal" )
type LogLibrary ¶
type LogLibrary string
LogLibrary Name
const ( // ZAP library ZAP LogLibrary = "zap" // LOGRUS library LOGRUS LogLibrary = "logrus" )
In built supported logger
type Printer ¶
type Printer interface { Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Fatal(args ...interface{}) Infof(format string, args ...interface{}) Info(args ...interface{}) Warnf(format string, args ...interface{}) Debugf(format string, args ...interface{}) Debug(args ...interface{}) }
Printer represent common interface for the Log
var Log Printer
Log implements all union of function from zap and logrus, that can be used for logging purpose. Default value is initialized with ZAP logger in Development mode.
Click to show internal directories.
Click to hide internal directories.