Documentation ¶
Index ¶
- Constants
- func DisableGRPCLog()
- func Discard()
- func GinLogger(server string) gin.HandlerFunc
- func ResetLogger()
- func Testing(tb testing.TB)
- type LevelDecoder
- func (ll *LevelDecoder) Decode(value string) error
- func (ll *LevelDecoder) Encode() (string, error)
- func (ll LevelDecoder) MarshalJSON() ([]byte, error)
- func (ll LevelDecoder) MarshalYAML() (interface{}, error)
- func (ll LevelDecoder) String() string
- func (ll *LevelDecoder) UnmarshalJSON(data []byte) error
- func (ll *LevelDecoder) UnmarshalYAML(unmarshal func(interface{}) error) error
- type SeverityHook
- type ZeroGRPCV2
- func (g *ZeroGRPCV2) Error(args ...interface{})
- func (g *ZeroGRPCV2) Errorf(format string, args ...interface{})
- func (g *ZeroGRPCV2) Errorln(args ...interface{})
- func (g *ZeroGRPCV2) Fatal(args ...interface{})
- func (g *ZeroGRPCV2) Fatalf(format string, args ...interface{})
- func (g *ZeroGRPCV2) Fatalln(args ...interface{})
- func (g *ZeroGRPCV2) Info(args ...interface{})
- func (g *ZeroGRPCV2) Infof(format string, args ...interface{})
- func (g *ZeroGRPCV2) Infoln(args ...interface{})
- func (g *ZeroGRPCV2) V(l int) bool
- func (g *ZeroGRPCV2) Warning(args ...interface{})
- func (g *ZeroGRPCV2) Warningf(format string, args ...interface{})
- func (g *ZeroGRPCV2) Warningln(args ...interface{})
Constants ¶
const ( GCPAlertLevel severityGCP = "ALERT" GCPCriticalLevel severityGCP = "CRITICAL" GCPErrorLevel severityGCP = "ERROR" GCPWarningLevel severityGCP = "WARNING" GCPInfoLevel severityGCP = "INFO" GCPDebugLevel severityGCP = "DEBUG" GCPFieldKeySeverity = "severity" GCPFieldKeyMsg = "message" GCPFieldKeyTime = "time" )
Variables ¶
This section is empty.
Functions ¶
func DisableGRPCLog ¶
func DisableGRPCLog()
DisableGRPCLog sets the grpclog V2 logger to the discard logger. This must be called before any grpc calls are made because this method is not mutex protected.
func GinLogger ¶
func GinLogger(server string) gin.HandlerFunc
GinLogger returns a new Gin middleware that performs logging for our JSON APIs using zerolog rather than the default Gin logger which is a standard HTTP logger. Provide the server name (e.g. adminAPI or BFF) to help us parse the logs. NOTE: we previously used github.com/dn365/gin-zerolog but wanted more customization.
func ResetLogger ¶
func ResetLogger()
Types ¶
type LevelDecoder ¶
LogLevelDecoder deserializes the log level from a config string.
func (*LevelDecoder) Decode ¶
func (ll *LevelDecoder) Decode(value string) error
Decode implements confire Decoder interface.
func (*LevelDecoder) Encode ¶
func (ll *LevelDecoder) Encode() (string, error)
Encode converts the loglevel into a string for use in YAML and JSON
func (LevelDecoder) MarshalJSON ¶
func (ll LevelDecoder) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (LevelDecoder) MarshalYAML ¶
func (ll LevelDecoder) MarshalYAML() (interface{}, error)
MarshalYAML implements yaml.Marshaler
func (LevelDecoder) String ¶
func (ll LevelDecoder) String() string
func (*LevelDecoder) UnmarshalJSON ¶
func (ll *LevelDecoder) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler
func (*LevelDecoder) UnmarshalYAML ¶
func (ll *LevelDecoder) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements yaml.Unmarshaler
type SeverityHook ¶
type SeverityHook struct{}
SeverityHook adds GCP severity levels to zerolog output log messages.
type ZeroGRPCV2 ¶
type ZeroGRPCV2 struct{}
Implements the grpclog.LoggerV2 interface to pass logging calls to zerolog. To enable grpclog with zerolog (e.g. for grpc logging to GCP) then set this logger before any grpc calls are made:
grpclog.SetLoggerV2(&logger.ZeroGRPCV2{})
This logger should respect the zerolog global log level from grpclog calls.
func (*ZeroGRPCV2) Error ¶
func (g *ZeroGRPCV2) Error(args ...interface{})
Error logs to ERROR log. Arguments are handled in the manner of fmt.Print.
func (*ZeroGRPCV2) Errorf ¶
func (g *ZeroGRPCV2) Errorf(format string, args ...interface{})
Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf.
func (*ZeroGRPCV2) Errorln ¶
func (g *ZeroGRPCV2) Errorln(args ...interface{})
Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println.
func (*ZeroGRPCV2) Fatal ¶
func (g *ZeroGRPCV2) Fatal(args ...interface{})
Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.
func (*ZeroGRPCV2) Fatalf ¶
func (g *ZeroGRPCV2) Fatalf(format string, args ...interface{})
Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.
func (*ZeroGRPCV2) Fatalln ¶
func (g *ZeroGRPCV2) Fatalln(args ...interface{})
Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. gRPC ensures that all Fatal logs will exit with os.Exit(1). Implementations may also call os.Exit() with a non-zero exit code.
func (*ZeroGRPCV2) Info ¶
func (g *ZeroGRPCV2) Info(args ...interface{})
Info logs to INFO log. Arguments are handled in the manner of fmt.Print.
func (*ZeroGRPCV2) Infof ¶
func (g *ZeroGRPCV2) Infof(format string, args ...interface{})
Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf.
func (*ZeroGRPCV2) Infoln ¶
func (g *ZeroGRPCV2) Infoln(args ...interface{})
Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println.
func (*ZeroGRPCV2) V ¶
func (g *ZeroGRPCV2) V(l int) bool
V reports whether verbosity level l is at least the requested verbose level.
func (*ZeroGRPCV2) Warning ¶
func (g *ZeroGRPCV2) Warning(args ...interface{})
Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print.
func (*ZeroGRPCV2) Warningf ¶
func (g *ZeroGRPCV2) Warningf(format string, args ...interface{})
Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf.
func (*ZeroGRPCV2) Warningln ¶
func (g *ZeroGRPCV2) Warningln(args ...interface{})
Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println.