Documentation
¶
Index ¶
- func AddFileOutput(logFilePath string) error
- func ChangeLevel(newLevel zapcore.Level)
- func GetInstance() *loggerSingleton
- func GetLogger() *zap.SugaredLogger
- func GetLogsChannel() <-chan LogMessage
- type ChannelCore
- func (c *ChannelCore) Check(entry zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
- func (c *ChannelCore) Enabled(level zapcore.Level) bool
- func (c *ChannelCore) Sync() error
- func (c *ChannelCore) With(fields []zapcore.Field) zapcore.Core
- func (c *ChannelCore) Write(entry zapcore.Entry, fields []zapcore.Field) error
- type DynamicWriteSyncer
- type LogMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFileOutput ¶
AddFileOutput adds a file write syncer to the logger
func ChangeLevel ¶
ChangeLevel dynamically changes the logging level
func GetInstance ¶
func GetInstance() *loggerSingleton
GetInstance initializes the singleton instance if it doesn't exist
func GetLogger ¶
func GetLogger() *zap.SugaredLogger
GetLogger returns the singleton SugaredLogger instance
func GetLogsChannel ¶
func GetLogsChannel() <-chan LogMessage
GetLogsChannel returns the logs channel
Types ¶
type ChannelCore ¶
type ChannelCore struct {
LevelEnabler zapcore.LevelEnabler
// contains filtered or unexported fields
}
ChannelCore is a custom zapcore.Core that writes logs to a channel
func (*ChannelCore) Check ¶
func (c *ChannelCore) Check(entry zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry
Check determines whether the supplied Entry should be logged
func (*ChannelCore) Enabled ¶
func (c *ChannelCore) Enabled(level zapcore.Level) bool
Enabled checks if the log level is enabled
func (*ChannelCore) Sync ¶
func (c *ChannelCore) Sync() error
Sync flushes buffered logs (no-op in this case)
type DynamicWriteSyncer ¶
type DynamicWriteSyncer struct {
// contains filtered or unexported fields
}
DynamicWriteSyncer manages multiple write syncers
func (*DynamicWriteSyncer) AddWriteSyncer ¶
func (d *DynamicWriteSyncer) AddWriteSyncer(ws zapcore.WriteSyncer)
func (*DynamicWriteSyncer) Sync ¶
func (d *DynamicWriteSyncer) Sync() error
type LogMessage ¶
LogMessage represents a single log entry
Click to show internal directories.
Click to hide internal directories.