logger

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 17 Imported by: 1

README

Logger library

wiki page

Documentation

Overview

Logger levels

0.1.0-1

Logger package

0.1.0

Log writers

0.1.0

Index

Constants

This section is empty.

Variables

View Source
var ConsTpls = map[LogLevel]string{
	LogFatal:   "[\033[31mFATAL\033[0m] %msg% (%file%:%line% %func%)",
	LogError:   "[\033[31mERROR\033[0m] %msg% (%file%:%line% %func%)",
	LogWarning: "[\033[33mWARNING\033[0m] %msg% (%file%:%line% %func%)",
	LogNotify:  "[\033[34mNOTIFY\033[0m] %msg% (%file%:%line% %func%)",
	LogInfo:    "[\033[32mINFO\033[0m] %msg% (%file%:%line% %func%)",
	LogDebug:   "[DBG] %msg% (%file%:%line% %func%)",
}

0.1.0-1

View Source
var FileTpls = map[LogLevel]string{
	LogFatal:   "%dt% [FATAL] %msg% (%file%:%line% %func%)",
	LogError:   "%dt% [ERROR] %msg% (%file%:%line% %func%): %msg%",
	LogWarning: "%dt% [WARNING] %msg% (%file%:%line% %func%): %msg%",
	LogNotify:  "%dt% [NOTIFY] %msg% (%file%:%line% %func%): %msg%",
	LogInfo:    "%dt% [INFO] %msg% (%file%:%line% %func%): %msg%",
	LogDebug:   "%dt% [DEBUG] %msg% (%file%:%line% %func%): %msg%",
}

0.1.0-1

View Source
var LevelByName = map[string]LogLevel{
	"fatal":   LogFatal,
	"error":   LogError,
	"warning": LogWarning,
	"notify":  LogNotify,
	"info":    LogInfo,
	"debug":   LogDebug,
}

0.1.3

View Source
var LevelNames = map[LogLevel]string{
	LogFatal:   "FATAL",
	LogError:   "ERROR",
	LogWarning: "WARN",
	LogNotify:  "NOTE",
	LogInfo:    "INFO",
	LogDebug:   "DBG",
}

0.1.0-1

View Source
var LogTimeFmt = ""

== Шаблоны >>

Functions

This section is empty.

Types

type Config

type Config struct {
	DSN  string //Строка подключения к хранилищу данных
	File string //Имя файла (с заменами)
	//= размеры каналов (буферов) >
	//При val =< 0 - канал не используется
	ConsBufSize  int
	StoreBufSize int
	FileBufSize  int
	//< размеры каналов (буферов) =
	//= Уровни логгирования >
	LevelCons  LogLevel
	LevelFile  LogLevel
	LevelStore LogLevel
}

type LogLevel

type LogLevel int

0.1.0-1

const (
	LogDebug LogLevel = iota
	LogInfo
	LogNotify
	LogWarning
	LogError
	LogFatal
)

0.1.0-1

func GetLevelByName

func GetLevelByName(name string) (lvl LogLevel, err *errs.Err)

0.1.3

type LogRec

type LogRec struct {
	Time    time.Time
	Level   string
	Msg     string
	Data    datatypes.JSONMap
	SrcFunc string
	SrcFile string
}

Запись в БД

0.1.0-1

type Logger

type Logger struct {
	Dbg    bool
	Silent bool

	ConsTpls map[LogLevel]string
	FileTpls map[LogLevel]string
	TimeFMT  string
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) (log *Logger)

0.1.5

func (*Logger) Debug

func (l *Logger) Debug(msg string, data ...map[string]interface{})

0.1.0-1

func (*Logger) Error

func (l *Logger) Error(msg string, data ...map[string]interface{})

0.1.0-1

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, data ...map[string]interface{})

0.1.0-1

func (*Logger) Info

func (l *Logger) Info(msg string, data ...map[string]interface{})

0.1.0-1

func (*Logger) Init added in v0.1.5

func (l *Logger) Init() *errs.Err

func (*Logger) Notify

func (l *Logger) Notify(msg string, data ...map[string]interface{})

0.1.0-1

func (*Logger) Start

func (l *Logger) Start() (err *errs.Err)

0.1.5

func (*Logger) Stop

func (l *Logger) Stop()

0.1.5

func (*Logger) Warning

func (l *Logger) Warning(msg string, data ...map[string]interface{})

0.1.0-1

type Rec

type Rec struct {
	Level LogLevel
	Time  time.Time
	Msg   string
	Data  datatypes.JSONMap
	// contains filtered or unexported fields
}

Запись логгера

0.1.0-1

Jump to

Keyboard shortcuts

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