logger

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 7 Imported by: 7

README

logger - Красивый и информативный логгер

Пример формата

{{font:b}}{{color:f}}{{color:b}} {{level}} {{color:rb}} {{time:2006/01/02--15:04:05}} >>> WHERE
   {{file:1}}
MSG {{r}}"{{message}}"
  • {{font:b}} - установка жирности текста
  • {{font:rb}} - снятие жирности текста
  • {{color:f}} - установка цвета шрифта
  • {{color:rf}} - установка цвета шрифта по умолчанию
  • {{color:b}} - установка цвета фона
  • {{color:rb}} - установка цвета фона по умолчанию
  • {{r}} - Сбрасывает все настройки
  • {{level}} - Название уровня
  • {{time:2006/01/02--15:04:05}} - Время сообщения и его формат
  • {{file:1}} - Выаодит trace с уровнем отображения пути файлов
  • {{message}} - Сообщение пользователя

Documentation

Index

Constants

View Source
const (
	LInfo    levelKey = "INFO"
	LService levelKey = "SERVICE"
	LWarning levelKey = "WARNING"
	LError   levelKey = "ERROR"
	LFatal   levelKey = "FATAL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logerer added in v1.1.0

type Logerer interface {
	Info(args ...interface{})
	Service(args ...interface{})
	Warning(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Infof(format string, args ...interface{})
	Servicef(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}
var Log Logerer

func InitLogger

func InitLogger(option Options) Logerer

InitLogger иницилезирует логгер если pathFile = "", то фаил лога не создастся

type Options added in v1.1.0

type Options interface {
	SetLevelFormatConsole(level levelKey, format string) Options
	SetLevelFormatFile(level levelKey, format string) Options
	SetLevelFile(level levelKey, path string) Options
	SetLevelColor(level levelKey, color int) Options
	SetLevelBackColor(level levelKey, color int) Options
	SetFormatConsole(format string) Options
	SetFormatFile(format string) Options
	SetFile(path string) Options
	// contains filtered or unexported methods
}

func InitOptions added in v1.1.0

func InitOptions() Options

Jump to

Keyboard shortcuts

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