servicelogger

package module
v1.0.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Overview

Package servicelogger - implements a file logger for services

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogLevelToString

func LogLevelToString(level LogLevel) string

LogLevelToString returns a string representation of the LogLevel

Types

type FacilityFilter

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

type FacilityFilters

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

type LogLevel

type LogLevel int
const (
	LL_TRACE LogLevel = 1
	LL_DEBUG LogLevel = 2
	LL_INFO  LogLevel = 3
	LL_WARN  LogLevel = 4
	LL_ERROR LogLevel = 5
	LL_FATAL LogLevel = 6
)

func StringToLogLevel

func StringToLogLevel(text string) LogLevel

StringToLogLevel returns a LogLevel for a provided string. When the string cannot be recognised, LL_INFO is returned

type Logger

type Logger struct {
	MinLoglevel LogLevel
	// contains filtered or unexported fields
}

func New

func New(prefix string, filename string, minloglevel LogLevel, rotate bool, rotatesize string, keep int) (l Logger, err error)

New returns a new Logger object

func (*Logger) AddFacilityFilter

func (slog *Logger) AddFacilityFilter(filtername string, filterlevel LogLevel)

func (*Logger) ApplyNewSettings

func (slog *Logger) ApplyNewSettings(newFile string, newLevel LogLevel, newRotation bool, newRotSize string, newKeep int) bool

func (Logger) DumpLogFilters

func (slog Logger) DumpLogFilters() FacilityFilters

func (*Logger) LoadFacilityFilters

func (slog *Logger) LoadFacilityFilters(filename string) error

func (*Logger) LogDebug

func (l *Logger) LogDebug(function string, source string, text string)

LogDebug logs a message at DEBUG level

func (*Logger) LogError

func (l *Logger) LogError(function string, source string, text string)

LogError logs a message at ERROR level

func (*Logger) LogFatal

func (l *Logger) LogFatal(function string, source string, text string, exitcode int)

LogFata logs a message at FATAL level and exits the application with the provided exit code

func (*Logger) LogInfo

func (l *Logger) LogInfo(function string, source string, text string)

LogInfo logs a message at INFO level

func (*Logger) LogTrace

func (l *Logger) LogTrace(function string, source string, text string)

LogTrace logs a message at TRACE level

func (*Logger) LogWarn

func (l *Logger) LogWarn(function string, source string, text string)

LogWarn logs a message at WARNING level

Jump to

Keyboard shortcuts

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