Documentation ¶
Overview ¶
Package log provides the both file and console (general) logging capabilities to spacemesh modules such as app and identity.
Index ¶
- Variables
- func Debug(msg string, args ...interface{})
- func DebugMode(mode bool)
- func Error(msg string, args ...interface{})
- func Info(msg string, args ...interface{})
- func InitSpacemeshLoggingSystem(dataFolderPath string, logFileName string)
- func JSONLog(b bool)
- func Level() zapcore.Level
- func Panic(msg string, args ...interface{})
- func Warning(msg string, args ...interface{})
- 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 FieldLogger
- 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 ¶
var Nop = zap.WrapCore(func(zapcore.Core) zapcore.Core { return zapcore.NewNopCore() })
Nop is an option that disables this logger.
Functions ¶
func Debug ¶
func Debug(msg string, args ...interface{})
Debug prints formatted debug level log message.
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 FieldLogger ¶ added in v0.1.11
type FieldLogger struct {
// contains filtered or unexported fields
}
FieldLogger is a logger that only logs messages with fields. it does not support formatting.g
func Event ¶
func Event() FieldLogger
Event returns a field logger with the Event field set to true.
func (FieldLogger) Debug ¶ added in v0.1.11
func (fl FieldLogger) Debug(msg string, fields ...LoggableField)
Debug prints message with fields
func (FieldLogger) Error ¶ added in v0.1.11
func (fl FieldLogger) Error(msg string, fields ...LoggableField)
Error prints message with fields
func (FieldLogger) Info ¶ added in v0.1.11
func (fl FieldLogger) Info(msg string, fields ...LoggableField)
Info prints message with fields
func (FieldLogger) Warning ¶ added in v0.1.11
func (fl FieldLogger) Warning(msg string, fields ...LoggableField)
Warning prints message with fields
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
NilLogger is a not initialized logger it will panic if you'll call methods on it.
func (Log) Event ¶
func (l Log) Event() FieldLogger
Event returns a logger with the Event field appended to it.
func (Log) SetLevel ¶ added in v0.1.2
func (l Log) SetLevel(level *zap.AtomicLevel) Log
SetLevel returns a logger with level as the log level derived from l.
func (Log) WithFields ¶
func (l Log) WithFields(fields ...LoggableField) Log
WithFields returns a logger with fields permanently appended to it.
type LoggableField ¶ added in v0.1.2
type LoggableField interface {
Field() Field
}
LoggableField as an interface to enable every type to be used as a log field.