Skip to content
/ l0gger Public

wrapper for quick and easy work with the logrus package in golang

License

Notifications You must be signed in to change notification settings

ret0rn/l0gger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

L0gger

l0gger

Wrapper for quick and easy work with the logrus package in golang

GitHub go.mod Go version GitHub release (latest by date) GitHub Repo stars GitHub

Install

go get github.com/ret0rn/l0gger

Formaters

  • JsonFormater
  • TextFormater

Log Levels

  • DebugLvl
  • InfoLvl
  • WarningLvl
  • ErrorLvl
  • FatalLvl
Log Level Log Messages
DEBUG DEBUG, INFO, WARNING, ERROR, FATAL
INFO INFO, WARNING, ERROR, FATAL
WARNING WARNING, ERROR, FATAL
ERROR ERROR, FATAL
FATAL FATAL

Log Out

  • File
  • Сonsole
  • Others io.Writer's

Usage

var log, err = l0gger.New([1], [2], [3]) 
  1. Log Out

    • type string - log to file
    • nil or os.Stdout - log to console
    • type io.Writer - others io.Writers
  2. Formaters

    • JsonFormater - JSON Formater

      {"file":"test.go:18","level":"info","msg":"hello","time":"2022-06-19T22:14:02+03:00"}

    • TextFormater - Text Formater

      time="2022-06-19T22:15:01+03:00" level=info msg=hello file="test.go:18"

  3. Level

    • DebugLvl
    • InfoLvl
    • WarningLvl
    • ErrorLvl
    • FatalLvl

Log to Console

import "github.com/ret0rn/l0gger"

func main() {

	var log, err = l0gger.New(nil, l0gger.JsonFormater, l0gger.DebugLvl)

	log.Info("Info test")
}

Log to File

import "github.com/ret0rn/l0gger"

func main() {

	var log, err = l0gger.New("logger.log", l0gger.JsonFormater, l0gger.DebugLvl)

	log.Info("Info test")
}

About

wrapper for quick and easy work with the logrus package in golang

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages