Documentation ¶
Index ¶
- func SetClientMsgHandler(l Logger, fn func(m WsMsg))
- type ChildLogger
- type Dog
- func (d *Dog) Close()
- func (d *Dog) Error(format string, a ...Fielder) Logger
- func (d *Dog) Fatal(format string, a ...Fielder)
- func (d *Dog) Info(format string, a ...Fielder) Logger
- func (d *Dog) Log(level Level, msg string, fields ...Fielder) Logger
- func (d *Dog) SetMinLevel(level Level) Logger
- func (d *Dog) Transient(format string, a ...Fielder) Logger
- func (d *Dog) Verbose(format string, a ...Fielder) Logger
- func (d *Dog) Warning(format string, a ...Fielder) Logger
- type Field
- type FieldBool
- type FieldDuration
- type FieldError
- type FieldFloat64
- type FieldInt64
- type FieldString
- type FieldTimeFormat
- type FieldTimeUnix
- type FieldUint64
- type Fielder
- type FixedLineAdder
- type FixedLineRemover
- type IndexTemplate
- type Level
- type LogLine
- type Logger
- type MemFile
- type MemFileInfo
- type NullLogger
- func (n *NullLogger) Close()
- func (n *NullLogger) Error(format string, a ...Fielder) Logger
- func (n *NullLogger) Fatal(format string, a ...Fielder)
- func (n *NullLogger) Info(format string, a ...Fielder) Logger
- func (n *NullLogger) Log(level Level, format string, a ...Fielder) Logger
- func (n *NullLogger) SetMinLevel(level Level) Logger
- func (n *NullLogger) Transient(format string, a ...Fielder) Logger
- func (n *NullLogger) Verbose(format string, a ...Fielder) Logger
- func (n *NullLogger) Warning(format string, a ...Fielder) Logger
- type WsClient
- type WsMsg
- type WsRouter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetClientMsgHandler ¶
Types ¶
type ChildLogger ¶
type ChildLogger interface { // Parent returns the parent Logger, or nil if it has no parent. Parent() Logger }
ChildLogger is the interface for loggers that feed back to a parent.
type Dog ¶
type Dog struct {
// contains filtered or unexported fields
}
func (*Dog) SetMinLevel ¶
SetMinLevel is part of the Logger interface
type FieldDuration ¶
func Duration ¶
func Duration(name string, value time.Duration) FieldDuration
Duration adds a time.Duration field
func (FieldDuration) Field ¶
func (f FieldDuration) Field() Field
type FieldError ¶
func (FieldError) Field ¶
func (f FieldError) Field() Field
type FieldFloat64 ¶
func Float32 ¶
func Float32(name string, value float32) FieldFloat64
Float32 adds a 32-bit floating point number field
func Float64 ¶
func Float64(name string, value float64) FieldFloat64
Float64 adds a 64-bit floating point number field
func (FieldFloat64) Field ¶
func (f FieldFloat64) Field() Field
type FieldInt64 ¶
func Int16 ¶
func Int16(name string, value int16) FieldInt64
Int16 adds a 16-bit signed integer field
func Int32 ¶
func Int32(name string, value int32) FieldInt64
Int32 adds a 32-bit signed integer field
func Int64 ¶
func Int64(name string, value int64) FieldInt64
Int64 adds a 64-bit signed integer field
func (FieldInt64) Field ¶
func (f FieldInt64) Field() Field
type FieldString ¶
func String ¶
func String(name string, value string) FieldString
String adds an escaped and quoted string field
func (FieldString) Field ¶
func (f FieldString) Field() Field
type FieldTimeFormat ¶
func Time ¶
func Time(name string, value time.Time) FieldTimeFormat
Time adds a time.Time field that will output a string formatted using RFC 3339 (ISO 8601)
func TimeNano ¶
func TimeNano(name string, value time.Time) FieldTimeFormat
TimeNano adds a time.Time field that will output a string formatted using RFC 3339 with nanosecond precision
func (FieldTimeFormat) Field ¶
func (f FieldTimeFormat) Field() Field
type FieldTimeUnix ¶
func TimeUnix ¶
func TimeUnix(name string, value time.Time) FieldTimeUnix
TimeUnix adds a time.Time field that outputs as a unix epoch (unsigned integer)
func TimeUnixNano ¶
func TimeUnixNano(name string, value time.Time) FieldTimeUnix
TimeUnixNano adds a time.Time field that outputs as a unix epoch with nanosecond precision (unsigned integer)
func (FieldTimeUnix) Field ¶
func (f FieldTimeUnix) Field() Field
type FieldUint64 ¶
func Byte ¶
func Byte(name string, value byte) FieldUint64
Byte adds an 8-bit unsigned integer field
func Uint16 ¶
func Uint16(name string, value uint16) FieldUint64
Uint16 adds a 16-bit unsigned integer field
func Uint32 ¶
func Uint32(name string, value uint32) FieldUint64
Uint32 adds a 32-bit unsigned integer field
func Uint64 ¶
func Uint64(name string, value uint64) FieldUint64
Uint64 adds a 64-bit unsigned integer field
func Uint8 ¶
func Uint8(name string, value uint8) FieldUint64
Uint8 adds an 8-bit unsigned integer field
func (FieldUint64) Field ¶
func (f FieldUint64) Field() Field
type Fielder ¶
type Fielder interface {
Field() Field
}
Fielder is an interface used to add structured logging to calls to Logger methods
type FixedLineAdder ¶
type FixedLineAdder interface {
AddFixedLine() Logger
}
FixedLineAdder is the interface for loggers that support fixing a line in place, for progress bars or other transient status messages.
type FixedLineRemover ¶
type FixedLineRemover interface {
RemoveFixedLine()
}
FixedLineRemover is the interface that a fixed line logger must implement in order for the fixed line to be removed before app end.
type IndexTemplate ¶
type Logger ¶
type Logger interface { // Close ensures any buffers are flushed and any resources released. // It is safe to call Close more than once (but consecutive calls do nothing). Close() // SetMinLevel sets the lowest Level that will be logged. SetMinLevel(level Level) Logger // Log is how all log lines are added. Log(level Level, format string, a ...Fielder) Logger // Transient et al are just shortcuts for calling Log with specific levels. // Note that Fatal will never return, as it flushes any buffers then calls os.Exit(-1). Transient(format string, a ...Fielder) Logger Verbose(format string, a ...Fielder) Logger Info(format string, a ...Fielder) Logger Warning(format string, a ...Fielder) Logger Error(format string, a ...Fielder) Logger Fatal(format string, a ...Fielder) }
type MemFileInfo ¶
func (*MemFileInfo) IsDir ¶
func (i *MemFileInfo) IsDir() bool
func (*MemFileInfo) ModTime ¶
func (i *MemFileInfo) ModTime() time.Time
func (*MemFileInfo) Mode ¶
func (i *MemFileInfo) Mode() os.FileMode
func (*MemFileInfo) Name ¶
func (i *MemFileInfo) Name() string
func (*MemFileInfo) Size ¶
func (i *MemFileInfo) Size() int64
func (*MemFileInfo) Sys ¶
func (i *MemFileInfo) Sys() interface{}
type NullLogger ¶
type NullLogger struct { }
func (*NullLogger) Close ¶
func (n *NullLogger) Close()
func (*NullLogger) Fatal ¶
func (n *NullLogger) Fatal(format string, a ...Fielder)
func (*NullLogger) SetMinLevel ¶
func (n *NullLogger) SetMinLevel(level Level) Logger
type WsClient ¶
type WsClient struct {
// contains filtered or unexported fields
}
WsClient holds the open connection to individual websocket clients. It manages reading, writing, and lifetime.
func (*WsClient) BeginShutDown ¶
func (c *WsClient) BeginShutDown()
BeginShutDown requests that this client shut itself down. BeginShutDown will nop if called after client begins shutting down.
func (*WsClient) Send ¶
func (c *WsClient) Send(msg json.RawMessage)
Send is a thread-safe call to send a message to this client. Send will nop if called after client begins shutting down.
func (*WsClient) WaitForShutDown ¶
func (c *WsClient) WaitForShutDown()
Close breaks the connection, waits for everything to halt, then updates the owner.
type WsRouter ¶
type WsRouter struct {
// contains filtered or unexported fields
}
func NewWsRouter ¶
NewWsRouter creates a new WsRouter type
func (*WsRouter) BeginShutdown ¶
func (r *WsRouter) BeginShutdown()
func (*WsRouter) Broadcast ¶
func (r *WsRouter) Broadcast(msg json.RawMessage)
func (*WsRouter) SetClientMsgHandler ¶
func (*WsRouter) Start ¶
func (r *WsRouter) Start()
Start our websocket router, accepting various requests
func (*WsRouter) WaitForShutdown ¶
func (r *WsRouter) WaitForShutdown()