Documentation ¶
Overview ¶
Package log provides the both file and console (general) logging capabilities to spacemesh modules such as app and identity.
Index ¶
- Variables
- func AddDynamicLevel(level *zap.AtomicLevel) zap.Option
- func Debug(msg string, args ...interface{})
- func DebugMode(mode bool)
- func EnableLevelOption(enabler zapcore.LevelEnabler) zap.Option
- func Error(msg string, args ...interface{})
- func Event() fieldLogger
- func Info(msg string, args ...interface{})
- func InitSpacemeshLoggingSystem(dataFolderPath string, logFileName string)
- func JSONLog(b bool)
- func LogLvl() zapcore.Level
- func Panic(msg string, args ...interface{})
- func Warning(msg string, args ...interface{})
- func With() fieldLogger
- type Field
- func AtxId(val string) Field
- func BlockId(val string) Field
- func Bool(name string, val bool) Field
- func ByteString(name string, val []byte) Field
- func Duration(name string, val time.Duration) Field
- func EpochId(val uint64) Field
- func Err(v error) Field
- func Int(name string, val int) Field
- func Int32(name string, val int32) Field
- func LayerId(val uint64) Field
- func Namespace(name string) Field
- func NodeId(val string) Field
- func String(name, val string) Field
- func TxId(val string) Field
- func Uint32(name string, val uint32) Field
- func Uint64(name string, val uint64) Field
- type Log
- func (l Log) Debug(format string, args ...interface{})
- func (l Log) Error(format string, args ...interface{})
- func (l Log) Event() fieldLogger
- func (l Log) Info(format string, args ...interface{})
- func (l Log) Panic(format string, args ...interface{})
- func (l Log) SetLevel(level *zap.AtomicLevel) Log
- func (l Log) Warning(format string, args ...interface{})
- func (l Log) With() fieldLogger
- func (l Log) WithFields(fields ...LoggableField) Log
- func (l Log) WithName(prefix string) Log
- func (l Log) WithOptions(opts ...zap.Option) Log
- type LoggableField
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var DebugLevel = zap.LevelEnablerFunc(func(lvl zapcore.Level) bool { return lvl >= zapcore.DebugLevel })
View Source
var ErrorLevel = zap.LevelEnablerFunc(func(lvl zapcore.Level) bool { return lvl >= zapcore.ErrorLevel })
View Source
var InfoLevel = zap.LevelEnablerFunc(func(lvl zapcore.Level) bool { return lvl >= zapcore.InfoLevel })
View Source
var Nop = zap.WrapCore(func(zapcore.Core) zapcore.Core { return zapcore.NewNopCore() })
Functions ¶
func AddDynamicLevel ¶
func AddDynamicLevel(level *zap.AtomicLevel) zap.Option
func Debug ¶
func Debug(msg string, args ...interface{})
Debug prints formatted debug level log message.
func EnableLevelOption ¶
func EnableLevelOption(enabler zapcore.LevelEnabler) zap.Option
func Error ¶
func Error(msg string, args ...interface{})
Error prints formatted error level log message.
func Info ¶
func Info(msg string, args ...interface{})
Info prints formatted info level log message.
func InitSpacemeshLoggingSystem ¶
InitSpacemeshLoggingSystem initializes app logging system.
Types ¶
type Field ¶
Field is a log field holding a name and value
func ByteString ¶
ByteString returns a byte string ([]byte) Field
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is an exported type that embeds our logger.
var AppLog Log
AppLog is the local app singleton logger.
var NilLogger Log
func NewDefault ¶
func NewWithErrorLevel ¶
New creates a logger for a module. e.g. p2p instance logger.
func (Log) WithFields ¶
func (l Log) WithFields(fields ...LoggableField) Log
type LoggableField ¶ added in v0.1.2
type LoggableField interface {
Field() Field
}
Click to show internal directories.
Click to hide internal directories.