logger

package
v0.0.0-...-24cf382 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX = 6
)

Some Constants

Variables

View Source
var (
	FuncMaintenanceType = LogType{/* contains filtered or unexported fields */}
	DebugType           = LogType{/* contains filtered or unexported fields */}
)

Functions

func GetManager

func GetManager() *manager

GetManager - This function returns singleton instance of Logger Manager

Types

type Error

type Error struct {
	Err error
}

Error Object

func NewError

func NewError(err error) *Error

NewError - return a new instance of Error

func (*Error) Error

func (err *Error) Error() string

Error method - satisfying error interface

type LogLevel

type LogLevel int

LogLevel Object

const (
	DEBUG LogLevel = MAX - iota
	INFO
	WARNING
	ERROR
)

Some Constants - used with LogLevel

func StringToLogLevel

func StringToLogLevel(level string) LogLevel

func (LogLevel) IsLogLevel

func (l LogLevel) IsLogLevel() bool

IsLogLevel - check whether is a true log level

func (LogLevel) String

func (l LogLevel) String() string

type LogMeWrapper

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

LogMeWrapper structure - implements Logger interface

func (*LogMeWrapper) Close

func (l *LogMeWrapper) Close()

Close - it closes logger channel

func (*LogMeWrapper) Constructor

func (l *LogMeWrapper) Constructor(name string) error

Constructor - It initializes the logger configuration params

func (*LogMeWrapper) IsInitialized

func (l *LogMeWrapper) IsInitialized() bool

IsInitialized - that returns boolean value whether it's initialized

func (*LogMeWrapper) Log

func (l *LogMeWrapper) Log(obj *LogObject)

Log - write log object to the channel

func (*LogMeWrapper) Sync

func (l *LogMeWrapper) Sync()

Sync - sync all logs to medium

type LogObject

type LogObject struct {
	Level      LogLevel
	Module     string
	LogType    string
	Time       int64
	Additional interface{}
	Message    interface{}
}

LogObject - all methods that want to log must transfer object of this.

func NewLogObject

func NewLogObject(level LogLevel, module string, logType LogType, eventTime time.Time, message interface{}, additional interface{}) *LogObject

NewLogObject - enhance method to create and return reference of LogObject

type LogType

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

LogType Object

func NewLogType

func NewLogType(name string) LogType

NewLogType - Create A New Log Type

func (LogType) String

func (l LogType) String() string

type Logger

type Logger interface {
	Constructor(name string) error
	Close()
	Log(obj *LogObject)
	IsInitialized() bool
	Sync()
}

Logger interface

type OutputOption

type OutputOption struct {
	LevelStr string   `json:"level"`
	Level    LogLevel `json:"-"`
	Path     string   `json:"path,omitempty"`
	// contains filtered or unexported fields
}

type ZapWrapper

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

ZapWrapper structure - implements Logger interface

func (*ZapWrapper) Close

func (l *ZapWrapper) Close()

Close - it closes logger channel

func (*ZapWrapper) Constructor

func (l *ZapWrapper) Constructor(name string) error

Constructor - It initializes the logger configuration params

func (*ZapWrapper) Instance

func (l *ZapWrapper) Instance() *zap.Logger

Instance - returns exact logger instance

func (*ZapWrapper) IsInitialized

func (l *ZapWrapper) IsInitialized() bool

IsInitialized - that returns boolean value whether it's initialized

func (*ZapWrapper) Log

func (l *ZapWrapper) Log(obj *LogObject)

Log - write log object to the channel

func (*ZapWrapper) Sync

func (l *ZapWrapper) Sync()

Sync - call the sync method of the project

Jump to

Keyboard shortcuts

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