Documentation ¶
Index ¶
- Constants
- func GetCurrentLevel() string
- func Init(cfg *SysLogConfig) (logger *zap.Logger, closeLogger func() error, err error)
- func NewConfigLogger(consoleFileOut, consoleFileErr, jsonFileOut, jsonFileErr string) (logger *zap.Logger, closer []func(), err error)
- func NewFileSinker(logFilePath string) (sink zapcore.WriteSyncer, close func(), err error)
- func NewSysLogCore(isDevMode, isJsonEncoder bool, logLevel zap.AtomicLevel, logFilePath string) (zapcore.Core, func(), error)
- func NewSysLogEncoder(isDevMode bool, isJsonEncoder bool) zapcore.Encoder
- func NewSysLogLevel(logLevelStr string) zap.AtomicLevel
- func NewSysLogTeeCore(cfg *SysLogConfig) (zap.AtomicLevel, zapcore.Core, func(), error)
- func SetCurrentLevel(levelStr string) error
- type CoreBuilder
- type InitFunc
- type LogFieldsFunc
- type SysLogConfig
- type SysLogger
- type TeeCoreBuilder
Constants ¶
View Source
const ( STDOUT = "stdout" STDERR = "stderr" DefaultLogsLocation = "./logDatas/" )
Variables ¶
This section is empty.
Functions ¶
func GetCurrentLevel ¶
func GetCurrentLevel() string
func NewConfigLogger ¶
func NewFileSinker ¶
func NewFileSinker(logFilePath string) (sink zapcore.WriteSyncer, close func(), err error)
Construct log file sinker
func NewSysLogCore ¶
func NewSysLogEncoder ¶
Construct encoder
func NewSysLogLevel ¶
func NewSysLogLevel(logLevelStr string) zap.AtomicLevel
Always get supported level. If fail, fallback to "debug"
func NewSysLogTeeCore ¶
func NewSysLogTeeCore(cfg *SysLogConfig) (zap.AtomicLevel, zapcore.Core, func(), error)
func SetCurrentLevel ¶
Types ¶
type CoreBuilder ¶
type InitFunc ¶
type InitFunc func(cfg *SysLogConfig) (logger *zap.Logger, closeLogger func() error, err error)
type LogFieldsFunc ¶
var ( Debug LogFieldsFunc = defaultLogFunc Info LogFieldsFunc = defaultLogFunc Warn LogFieldsFunc = defaultLogFunc Error LogFieldsFunc = defaultLogFunc DPanic LogFieldsFunc = defaultLogFunc Panic LogFieldsFunc = defaultLogFunc Fatal LogFieldsFunc = defaultLogFunc Sync = defaultSyncFunc Close = defaultCloseFunc Log *zap.Logger )
type SysLogConfig ¶
type SysLogConfig struct { IsDevMode bool `yaml:"isDevMode"` LogLevel string `yaml:"logLevel"` EnableConsole bool `yaml:"enableConsole"` EnableConsoleFile bool `yaml:"enableConsoleFile"` EnalbeJsonFile bool `yaml:"enableJsonFile"` LogsLocation string `yaml:"logsLocation"` // logs storage location , must end with "\" or "/" which depend on OS LogFilePrefix string `yaml:"logFilePrefix"` // prefix of log files ConsoleOutput string `yaml:"consoleOutput"` // only support "stdout" or "stderr" // contains filtered or unexported fields }
func NewDevSysLogConfigDefault ¶
func NewDevSysLogConfigDefault() *SysLogConfig
func NewRelSysLogConfigDefault ¶
func NewRelSysLogConfigDefault() *SysLogConfig
func NewSysLogCfg ¶
func NewSysLogCfg() *SysLogConfig
type SysLogger ¶
type SysLogger struct { SysLogCfg *SysLogConfig CurrentLogLevel zap.AtomicLevel ZapLogger *zap.Logger }
type TeeCoreBuilder ¶
type TeeCoreBuilder func(cfg *SysLogConfig) (zap.AtomicLevel, zapcore.Core, func(), error)
Click to show internal directories.
Click to hide internal directories.