logger

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const MaxAttributeChars = 200

Variables

View Source
var Envs = [...]string{
	Production:  "prod",
	Development: "dev",
	Local:       "local",
}

Functions

func AnyCropped added in v0.0.7

func AnyCropped(key string, value interface{}) zap.Field

AnyCropped takes a key and an arbitrary value and chooses the best way to represent them as a field. It crops the content if it is larger than 200 characters.

func NewRedactor added in v0.0.5

func NewRedactor() *redactor

func SetLoggerMode

func SetLoggerMode(envStr string)

SetLoggerMode set Logger level from given string

Types

type AppEnv

type AppEnv int
const (
	Production AppEnv = iota
	Development
	Local
	Wrong
)

func EnvFromStr

func EnvFromStr(s string) AppEnv

func EnvFromStrE

func EnvFromStrE(s string) (AppEnv, error)

func (AppEnv) String

func (s AppEnv) String() string

type INodePing added in v0.0.8

type INodePing interface {
	LogNodeRequestSend(ctx context.Context, isHealthCheck bool, bc, id, addr string)
	LogNodeRequestHandled(ctx context.Context, isHealthCheck bool, bc, id, addr string)
}

type NodePing added in v0.0.8

type NodePing struct{}

func (*NodePing) LogNodeRequestHandled added in v0.0.8

func (n *NodePing) LogNodeRequestHandled(ctx context.Context, isHealthCheck bool, bc, id, addr string)

LogNodeRequestHandled logs a message about finishing handling the request to a node it marks the log entry as a healthcheck if isHealthCheck is true

func (*NodePing) LogNodeRequestSend added in v0.0.8

func (n *NodePing) LogNodeRequestSend(ctx context.Context, isHealthCheck bool, bc, id, addr string)

LogNodeRequestSend logs a message about sending the request to a node it marks the log entry as a healthcheck if isHealthCheck is true

type Zaplog

type Zaplog struct {
	*zap.Logger
	// contains filtered or unexported fields
}

func Log

func Log() *Zaplog

Log is invoking Zap Logger function

func LogFast added in v0.0.18

func LogFast(ctx *fasthttp.RequestCtx) *Zaplog

func LogWithContext

func LogWithContext(ctx context.Context) *Zaplog

LogWithContext is invoking Zap Logger function with context

func LogWithFastContext added in v0.0.16

func LogWithFastContext(ctx *fasthttp.RequestCtx) *Zaplog

LogWithFastContext is invoking Zap Logger function with fasthttp context

func (*Zaplog) DebugErr added in v0.0.5

func (z *Zaplog) DebugErr(e error, fields ...zapcore.Field) *Zaplog

func (*Zaplog) DebugRedact added in v0.0.5

func (z *Zaplog) DebugRedact(s string, fields ...zapcore.Field) *Zaplog

func (*Zaplog) ErrorErr added in v0.0.5

func (z *Zaplog) ErrorErr(e error, fields ...zapcore.Field) *Zaplog

func (*Zaplog) ErrorRedact added in v0.0.5

func (z *Zaplog) ErrorRedact(s string, fields ...zapcore.Field) *Zaplog

func (*Zaplog) FatalRedact added in v0.0.5

func (z *Zaplog) FatalRedact(s string, fields ...zapcore.Field) *Zaplog

func (*Zaplog) InfoErr added in v0.0.5

func (z *Zaplog) InfoErr(e error, fields ...zapcore.Field) *Zaplog

func (*Zaplog) InfoRedact added in v0.0.5

func (z *Zaplog) InfoRedact(s string, fields ...zapcore.Field) *Zaplog

func (*Zaplog) PanicErr added in v0.0.5

func (z *Zaplog) PanicErr(e error, fields ...zapcore.Field) *Zaplog

func (*Zaplog) PanicRedact added in v0.0.5

func (z *Zaplog) PanicRedact(s string, fields ...zapcore.Field) *Zaplog

func (Zaplog) Redact added in v0.0.5

func (r Zaplog) Redact(message string) string

func (*Zaplog) WarnErr added in v0.0.5

func (z *Zaplog) WarnErr(e error, fields ...zapcore.Field) *Zaplog

func (*Zaplog) WarnRedact added in v0.0.5

func (z *Zaplog) WarnRedact(s string, fields ...zapcore.Field) *Zaplog

func (*Zaplog) With added in v0.0.5

func (z *Zaplog) With(fields ...zapcore.Field) *Zaplog

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL