add bracket format
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"gitoa.ru/go-4devs/log"
|
||||
"gitoa.ru/go-4devs/log/field"
|
||||
@@ -16,9 +17,13 @@ func main() {
|
||||
log.Err(ctx, "error message", 42)
|
||||
service(ctx, log.Log())
|
||||
|
||||
logger := log.New(log.WithJSONFormat()).With(log.WithSource(10, log.TrimPath))
|
||||
logger := log.New(log.WithJSONFormat()).With(log.WithSource(10, log.TrimPath), log.WithTime(log.KeyTime, time.RFC3339))
|
||||
logger.AlertKV(ctx, "alert message new logger", field.String("string", "value"))
|
||||
service(ctx, logger)
|
||||
|
||||
strLogger := log.New(log.WithFormat(log.FormatWithBracket())).With(log.WithSource(10, log.TrimPath), log.WithTime(log.KeyTime, time.RFC3339))
|
||||
strLogger.AlertKV(ctx, "alert message new txt logger", field.String("string", "value"))
|
||||
service(ctx, strLogger)
|
||||
}
|
||||
|
||||
func service(ctx context.Context, logger log.Logger) {
|
||||
|
||||
Reference in New Issue
Block a user