Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Caller ¶ added in v0.3.1
func (Caller) MarshalLogObject ¶ added in v0.3.1
func (ca Caller) MarshalLogObject(enc zapcore.ObjectEncoder) error
type DisabledField ¶ added in v0.1.1
type DisabledField uint8
const ( DisableTime DisabledField = 1 << iota DisableCaller DisableTrace DisableService DisableKey DisableCode DisableContext DisableError DisableNothing DisabledField = 0 DisableAll DisabledField = ^DisableNothing )
func (DisabledField) Has ¶ added in v0.1.1
func (d DisabledField) Has(flag DisabledField) bool
func (*DisabledField) Set ¶ added in v0.1.1
func (d *DisabledField) Set(flag DisabledField)
type Entry ¶
func (Entry) MarshalLogObject ¶
func (e Entry) MarshalLogObject(enc zapcore.ObjectEncoder) error
type Error ¶
func (Error) MarshalLogObject ¶
func (err Error) MarshalLogObject(enc zapcore.ObjectEncoder) error
type Logger ¶
func New ¶ added in v0.1.1
Example (Production) ¶
package main import ( "go.uber.org/zap" "github.com/tigorlazuardi/maleo" "github.com/tigorlazuardi/maleo/maleozap" ) func main() { logger, err := zap.NewProduction() if err != nil { panic(err) } mlog := maleozap.New(logger) maleo.Global().SetLogger(mlog) }
Output:
func (*Logger) SetDisabledFieldFlag ¶ added in v0.1.1
func (l *Logger) SetDisabledFieldFlag(flag DisabledField)
SetDisabledFieldFlag sets the field from Maleo's Entry or Maleo's Error from being added to the zap log fields.
e.g. SetDisableField(maleozap.DisableTime | maleozap.DisableCaller) will prevent data of Error.Time() or Error.Caller() from being printed.
func (*Logger) SetTraceCapturer ¶
func (l *Logger) SetTraceCapturer(capturer TraceCapturer)
type LoggerOption ¶ added in v0.1.1
type LoggerOption interface {
Apply(*Logger)
}
func WithDisableFieldFlag ¶ added in v0.1.1
func WithDisableFieldFlag(fieldFlag DisabledField) LoggerOption
func WithTraceCapturer ¶ added in v0.1.1
func WithTraceCapturer(capturer TraceCapturer) LoggerOption
type LoggerOptionFunc ¶ added in v0.1.1
type LoggerOptionFunc func(*Logger)
func (LoggerOptionFunc) Apply ¶ added in v0.1.1
func (f LoggerOptionFunc) Apply(l *Logger)
type TraceCapturerFunc ¶
func (TraceCapturerFunc) CaptureTrace ¶
func (f TraceCapturerFunc) CaptureTrace(ctx context.Context) []zap.Field
Click to show internal directories.
Click to hide internal directories.