logger

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Logger Interface Use instance of logger instead of exported functions

usage example

import (

"errors"
"github.com/rudderlabs/rudder-utils/logger"

)

var log logger.LoggerI = &logger.LoggerT{}

or

var log logger.LoggerI = logger.NewLogger()

...

log.Error(...)

Index

Constants

This section is empty.

Variables

Functions

func GetLoggingConfig

func GetLoggingConfig() map[string]int

func SetModuleLevel

func SetModuleLevel(module string, levelStr string) error

SetModuleLevel sets log level for a module and it's children Pass empty string for module parameter for resetting root logging level

Types

type ConfigLogger

type ConfigLogger struct {
	RootLevel           string
	EnableConsole       bool
	EnableFile          bool
	ConsoleJsonFormat   bool
	FileJsonFormat      bool
	LogFileLocation     string
	LogFileSize         int
	EnableTimestamp     bool
	EnableFileNameInLog bool
	EnableStackTrace    bool
	LevelConfigStr      string
}
var (
	DefaultConfigLogger ConfigLogger
)

type LoggerI

type LoggerI interface {
	IsDebugLevel() bool
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	LogRequest(req *http.Request)
	Child(s string) LoggerI
}

type LoggerT

type LoggerT struct {
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(configList ...interface{}) *LoggerT

func (*LoggerT) Child

func (l *LoggerT) Child(s string) LoggerI

func (*LoggerT) Debug

func (l *LoggerT) Debug(args ...interface{})

Debug level logging. Most verbose logging level.

func (*LoggerT) Debugf

func (l *LoggerT) Debugf(format string, args ...interface{})

Debugf does debug level logging similar to fmt.Printf. Most verbose logging level

func (*LoggerT) Error

func (l *LoggerT) Error(args ...interface{})

Error level logging. Use this to log errors which dont immediately halt the application.

func (*LoggerT) Errorf

func (l *LoggerT) Errorf(format string, args ...interface{})

Errorf does error level logging similar to fmt.Printf. Use this to log errors which dont immediately halt the application.

func (*LoggerT) Fatal

func (l *LoggerT) Fatal(args ...interface{})

Fatal level logging. Use this to log errors which crash the application.

func (*LoggerT) Fatalf

func (l *LoggerT) Fatalf(format string, args ...interface{})

Fatalf does fatal level logging similar to fmt.Printf. Use this to log errors which crash the application.

func (*LoggerT) Info

func (l *LoggerT) Info(args ...interface{})

Info level logging. Use this to log the state of the application. Dont use Logger.Info in the flow of individual events. Use Logger.Debug instead.

func (*LoggerT) Infof

func (l *LoggerT) Infof(format string, args ...interface{})

Infof does info level logging similar to fmt.Printf. Use this to log the state of the application. Dont use Logger.Info in the flow of individual events. Use Logger.Debug instead.

func (*LoggerT) IsDebugLevel

func (l *LoggerT) IsDebugLevel() bool

IsDebugLevel Returns true is debug lvl is enabled

func (*LoggerT) LogRequest

func (l *LoggerT) LogRequest(req *http.Request)

LogRequest reads and logs the request body and resets the body to original state.

func (*LoggerT) Warn

func (l *LoggerT) Warn(args ...interface{})

Warn level logging. Use this to log warnings

func (*LoggerT) Warnf

func (l *LoggerT) Warnf(format string, args ...interface{})

Warnf does warn level logging similar to fmt.Printf. Use this to log warnings

Jump to

Keyboard shortcuts

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