Documentation ¶
Index ¶
- func Account(a fmt.Stringer) zap.Field
- func AssetID(id string) zap.Field
- func BigInt(key string, val fmt.Stringer) zap.Field
- func BigUint(key string, val fmt.Stringer) zap.Field
- func Binary(key string, val []byte) zap.Field
- func Bool(key string, val bool) zap.Field
- func ByteString(key string, val []byte) zap.Field
- func Candle(c fmt.Stringer) zap.Field
- func CandleWithTag(c fmt.Stringer, tag string) zap.Field
- func Complex128(key string, val complex128) zap.Field
- func Complex64(key string, val complex64) zap.Field
- func Decimal(key string, val fmt.Stringer) zap.Field
- func Duration(key string, value time.Duration) zap.Field
- func Error(val error) zap.Field
- func EthereumAddresses(addresses []common.Address) zap.Field
- func Float32(key string, val float32) zap.Field
- func Float64(key string, val float64) zap.Field
- func Hash(h []byte) zap.Field
- func Int(key string, val int) zap.Field
- func Int16(key string, val int16) zap.Field
- func Int32(key string, val int32) zap.Field
- func Int64(key string, val int64) zap.Field
- func Int8(key string, val int8) zap.Field
- func LiquidityID(id string) zap.Field
- func LiquidityProvisionAmendment(lp fmt.Stringer) zap.Field
- func LiquidityProvisionAmendmentProto(lp *commandspb.LiquidityProvisionAmendment) zap.Field
- func LiquidityProvisionCancellation(lp fmt.Stringer) zap.Field
- func LiquidityProvisionCancellationProto(lp *commandspb.LiquidityProvisionCancellation) zap.Field
- func LiquidityProvisionSubmission(lp fmt.Stringer) zap.Field
- func LiquidityProvisionSubmissionProto(lp *commandspb.LiquidityProvisionSubmission) zap.Field
- func Market(m fmt.Stringer) zap.Field
- func MarketID(id string) zap.Field
- func Order(o fmt.Stringer) zap.Field
- func OrderAmendment(oa fmt.Stringer) zap.Field
- func OrderAmendmentProto(oa *commandspb.OrderAmendment) zap.Field
- func OrderCancellation(oc fmt.Stringer) zap.Field
- func OrderID(id string) zap.Field
- func OrderSubmission(os fmt.Stringer) zap.Field
- func OrderSubmissionProto(os *commandspb.OrderSubmission) zap.Field
- func OrderWithTag(o fmt.Stringer, tag string) zap.Field
- func Party(p fmt.Stringer) zap.Field
- func PartyID(id string) zap.Field
- func ProposalID(id string) zap.Field
- func ProtoAccount(a ptypes.Account) zap.Field
- func ProtoOrder(o ptypes.Order) zap.Field
- func Reflect(key string, val interface{}) zap.Field
- func String(key string, val string) zap.Field
- func Strings(key string, val []string) zap.Field
- func Time(key string, t time.Time) zap.Field
- func TraceID(e Tracer) zap.Field
- func Trade(t fmt.Stringer) zap.Field
- func Uint(key string, val uint) zap.Field
- func Uint16(key string, val uint16) zap.Field
- func Uint32(key string, val uint32) zap.Field
- func Uint64(key string, val uint64) zap.Field
- func Uint8(key string, val uint8) zap.Field
- func Uintptr(key string, val uintptr) zap.Field
- func WithdrawSubmission(lp fmt.Stringer) zap.Field
- func WithdrawSubmissionProto(lp *commandspb.WithdrawSubmission) zap.Field
- func WithdrawalID(id string) zap.Field
- type Config
- type Custom
- type Level
- type Logger
- func (log *Logger) AtExit()
- func (log *Logger) Check(l Level) bool
- func (log *Logger) Clone() *Logger
- func (log *Logger) Debugf(s string, args ...interface{})
- func (log *Logger) Errorf(s string, args ...interface{})
- func (log *Logger) GetEnvironment() string
- func (log *Logger) GetLevel() Level
- func (log *Logger) GetLevelString() string
- func (log *Logger) GetName() string
- func (log *Logger) GooseLogger() *ZapGooseLogger
- func (log *Logger) Infof(s string, args ...interface{})
- func (log *Logger) IsDebug() bool
- func (log *Logger) Named(name string) *Logger
- func (log *Logger) SetLevel(level Level)
- func (log *Logger) ToSugared() *zap.SugaredLogger
- func (log *Logger) Warningf(s string, args ...interface{})
- func (log *Logger) With(fields ...zap.Field) *Logger
- type Tracer
- type Zap
- type ZapEncoder
- type ZapGooseLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Binary ¶
Binary constructs a field that carries an opaque binary blob.
Binary data is serialized in an encoding-appropriate format. For example, zap's JSON encoder base64-encodes binary blobs. To log UTF-8 encoded text, use ByteString.
func ByteString ¶
ByteString constructs a field that carries UTF-8 encoded text as a []byte. To log opaque binary blobs (which aren't necessarily valid UTF-8), use Binary.
func CandleWithTag ¶
CandleWithTag constructs a field with the given VEGA candle proto value and key equal to the tag string.
func Complex128 ¶
func Complex128(key string, val complex128) zap.Field
Complex128 constructs a field that carries a complex number. Unlike most numeric fields, this costs an allocation (to convert the complex128 to interface{}).
func Complex64 ¶
Complex64 constructs a field that carries a complex number. Unlike most numeric fields, this costs an allocation (to convert the complex64 to interface{}).
func EthereumAddresses ¶ added in v0.70.2
func Float32 ¶
Float32 constructs a field that carries a float32. The way the floating-point value is represented is encoder-dependent, so marshaling is necessarily lazy.
func Float64 ¶
Float64 constructs a field that carries a float64. The way the floating-point value is represented is encoder-dependent, so marshaling is necessarily lazy.
func LiquidityID ¶
func LiquidityProvisionAmendmentProto ¶
func LiquidityProvisionAmendmentProto( lp *commandspb.LiquidityProvisionAmendment, ) zap.Field
func LiquidityProvisionCancellationProto ¶
func LiquidityProvisionCancellationProto( lp *commandspb.LiquidityProvisionCancellation, ) zap.Field
func LiquidityProvisionSubmissionProto ¶
func LiquidityProvisionSubmissionProto( lp *commandspb.LiquidityProvisionSubmission, ) zap.Field
func OrderAmendment ¶
OrderAmendment constructs a single string field to contain all the object information.
func OrderAmendmentProto ¶
func OrderAmendmentProto(oa *commandspb.OrderAmendment) zap.Field
OrderAmendmentProto constructs a single string field to contain all the object information.
func OrderSubmission ¶
OrderSubmission constructs a single string field to contain all the object information.
func OrderSubmissionProto ¶
func OrderSubmissionProto(os *commandspb.OrderSubmission) zap.Field
OrderSubmissionProto constructs a single string field to contain all the object information.
func OrderWithTag ¶
OrderWithTag constructs a field with the given VEGA order proto value and key equal to the tag string.
func ProposalID ¶
func ProtoAccount ¶
ProtoAccount constructs a field with the given VEGA account proto value.
func ProtoOrder ¶
ProtoOrder constructs a field with the given VEGA order proto value.
func Reflect ¶
Reflect constructs a field by running reflection over all the field of value passed as a parameter. This should never be used we basic log level, only in the case of Debug log level, and with guards on top of the actual log call for this level.
func WithdrawSubmissionProto ¶
func WithdrawSubmissionProto( lp *commandspb.WithdrawSubmission, ) zap.Field
func WithdrawalID ¶
Types ¶
type Config ¶
type Config struct { Environment string `long:"env" choice:"dev" choice:"custom"` Custom *Custom `tomlcp:"This section takes effect only when Environment is set to \"custom\"."` }
Config contains the configurable items for this package.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package-specific configuration, given a pointer to a logger instance to be used for logging within the package.
type Custom ¶
type Custom struct { Zap *Zap ZapEncoder *ZapEncoder }
Custom contains the custom log config.
type Level ¶
type Level int8
A Level is a logging priority. Higher levels are more important.
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel Level = -1 // InfoLevel is the default logging priority. InfoLevel Level = 0 // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel Level = 1 // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel Level = 2 // PanicLevel logs a message, then panics. PanicLevel Level = 4 // FatalLevel logs a message, then calls os.Exit(1). FatalLevel Level = 5 )
Logging levels (matching zap core internals).
func ParseLevel ¶
ParseLevel parse a log level from a string.
type Logger ¶
Logger is an abstraction on to of the zap logger.
func NewDevLogger ¶
func NewDevLogger() *Logger
NewDevLogger creates a new logger suitable for development environments.
func NewLoggerFromConfig ¶
NewLoggerFromConfig creates a standard or custom logger.
func NewProdLogger ¶
func NewProdLogger() *Logger
NewProdLogger creates a new logger suitable for production environments, including sending logs to ElasticSearch.
func NewTestLogger ¶
func NewTestLogger() *Logger
NewTestLogger creates a new logger suitable for golang unit test environments, ie when running "go test ./...".
func (*Logger) AtExit ¶
func (log *Logger) AtExit()
AtExit flushes the logs before exiting the process. Useful when an app shuts down so we store all logging possible. This is meant to be used with defer when initializing your logger.
func (*Logger) Check ¶
Check helps avoid spending CPU time on log entries that will never be printed.
func (*Logger) GetEnvironment ¶
GetEnvironment returns the current environment name.
func (*Logger) GetLevelString ¶
GetLevelString return a string representation of the current log level.
func (*Logger) GooseLogger ¶
func (log *Logger) GooseLogger() *ZapGooseLogger
func (*Logger) Named ¶
Named instantiate a new logger by cloning it first and name it with the string specified.
func (*Logger) ToSugared ¶
func (log *Logger) ToSugared() *zap.SugaredLogger
type Zap ¶
type Zap struct { Level Level Development bool Encoding string // console or json OutputPaths []string ErrorOutputPaths []string }
Zap configures a ZapConfig.
type ZapEncoder ¶
type ZapEncoder struct { CallerKey string EncodeCaller string EncodeDuration string EncodeLevel string EncodeName string EncodeTime string LevelKey string LineEnding string MessageKey string NameKey string TimeKey string }
ZapEncoder configures a ZapEncoderConfig.
type ZapGooseLogger ¶ added in v0.55.0
type ZapGooseLogger struct {
zap.SugaredLogger
}
func (*ZapGooseLogger) Print ¶ added in v0.55.0
func (l *ZapGooseLogger) Print(v ...interface{})
func (*ZapGooseLogger) Printf ¶ added in v0.55.0
func (l *ZapGooseLogger) Printf(format string, v ...interface{})
func (*ZapGooseLogger) Println ¶ added in v0.55.0
func (l *ZapGooseLogger) Println(v ...interface{})