Documentation ¶
Index ¶
Constants ¶
const ( TimestampFieldNameDefault = "t" MessageFieldNameDefault = "msg" )
Variables ¶
This section is empty.
Functions ¶
func ClientLoggerUnaryInterceptor ¶ added in v0.0.9
func ClientLoggerUnaryInterceptor(from, to string) grpc.UnaryClientInterceptor
ClientLoggerUnaryInterceptor returns a new unary client interceptor for log from what to
func InitLog ¶
InitLog initializes zerolog for this service you need provide stdout for your log this function will init default logger with default formatter and default hook
func SetDefaultDevLogger ¶ added in v0.1.0
func SetDefaultProductionLogger ¶ added in v0.1.0
Types ¶
type GRPCServerMWHook ¶ added in v0.1.0
type GRPCServerMWHook struct{}
GRPCServerMWHook will add req-id and handler name to your log
type TestLogger ¶ added in v0.2.0
type TestLogger struct {
// contains filtered or unexported fields
}
func NewTestLogger ¶ added in v0.2.0
func NewTestLogger(opts ...TestLoggerOps) *TestLogger
NewTestLogger returns new instance of TestLogger you need provide stdout for your log this function will init default logger with default formatter
as default TestLogger use Info level
as default TestLogger use os.Stdout
as default TestLogger use "unknown" as test name
func (*TestLogger) Printf ¶ added in v0.2.0
func (t *TestLogger) Printf(format string, v ...any)
type TestLoggerOps ¶ added in v0.2.0
type TestLoggerOps func(t *TestLogger)
func WithTestLoggerLevel ¶ added in v0.2.0
func WithTestLoggerLevel(lvl zerolog.Level) TestLoggerOps
WithTestLoggerLevel use for set custom level for TestLogger as level use zerolog.Level
func WithTestLoggerName ¶ added in v0.2.0
func WithTestLoggerName(name string) TestLoggerOps
WithTestLoggerName use for set custom name for TestLogger as name use string
func WithTestLoggerWriter ¶ added in v0.2.0
func WithTestLoggerWriter(w io.Writer) TestLoggerOps
WithTestLoggerWriter use for set custom writer for TestLogger