Skip to content

[feature] implement the DefaultLogger by following the Logger interface #1647

@hsluoyz

Description

@hsluoyz

implement the DefaultLogger by following the Logger interface

DefaultLogger's constructor should support below way to set output to buffer. it can also support printing to console if buf is not set.

var buf bytes.Buffer
defaultLogger.SetOutput(&buf)

LogEntry.IsActive can be used to filter not useful events (SetEventTypes)

OnBeforeEvent will set entry.StartTime, then in OnAfterEvent(), Duration can be calculated.

SetLogCallback can set user-provided function as callback for the log.

user-provided function callback will be called at the end of OnAfterEvent.

no Go test is needed to add

new go file's apache header is year 2026

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions