Documentation ¶
Index ¶
Constants ¶
const ( // GitalyLogDirEnvKey defines the environment variable used to specify the Gitaly log directory GitalyLogDirEnvKey = "GITALY_LOG_DIR" // LogTimestampFormat defines the timestamp format in log files LogTimestampFormat = "2006-01-02T15:04:05.000" // LogTimestampFormatUTC defines the utc timestamp format in log files LogTimestampFormatUTC = "2006-01-02T15:04:05.000Z" )
Variables ¶
var ( // Loggers is convenient when you want to apply configuration to all // loggers Loggers = []*logrus.Logger{defaultLogger, grpcGo} )
Functions ¶
func Configure ¶
Configure sets the format and level on all loggers. It applies level mapping to the GrpcGo logger.
func GrpcGo ¶
GrpcGo is a dedicated logrus logger for the grpc-go library. We use it to control the library's chattiness.
func UTCJsonFormatter ¶ added in v14.4.0
UTCJsonFormatter returns a Formatter that formats a logrus Entry's as json and converts the time field into UTC
func UTCTextFormatter ¶ added in v14.4.0
UTCTextFormatter returns a Formatter that formats a logrus Entry's as text and converts the time field into UTC
Types ¶
type HookLogger ¶
type HookLogger struct {
// contains filtered or unexported fields
}
HookLogger is a wrapper around *logrus.Logger
func NewHookLogger ¶
func NewHookLogger() *HookLogger
NewHookLogger creates a file logger, since both stderr and stdout will be displayed in git output
func (*HookLogger) Errorf ¶
func (h *HookLogger) Errorf(format string, a ...interface{})
Errorf logs a formatted error at the Fatal level
func (*HookLogger) Fatal ¶
func (h *HookLogger) Fatal(err error)
Fatal logs an error at the Fatal level and writes a generic message to stderr
func (*HookLogger) Fatalf ¶
func (h *HookLogger) Fatalf(format string, a ...interface{})
Fatalf logs a formatted error at the Fatal level
func (*HookLogger) Logger ¶
func (h *HookLogger) Logger() *logrus.Logger
Logger returns the underlying logrus logger