Skip to content

Zenitria/zenlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZenLog

A minimalist logging library for Go. Inspired by Charm Log.

Made with VHS

Features:

  • Colored and human readable output.
  • Multiple log levels (Debug, Info, Success, Warn, Error, Fatal).
  • Customizable time format.
  • Toggleable report caller.
  • Toggleable debug mode.

Installation

Use go get to install the package.

go get github.com/zenitria/zenlog@latest

Usage

Import package to your project.

import "github.com/zenitria/zenlog"

Send logs

zenlog.Debug("Debug message") // Works only in debug mode
zenlog.Info("Info message")
zenlog.Success("Success message")
zenlog.Warning("Warning message")
zenlog.Error("Error message")
zenlog.Fatal("Fatal message") // Exits with code 1

Format messages

zenlog.Debugf("Debug message with %s", "formatting") // Works only in debug mode
zenlog.Infof("Info message with %s", "formatting")
zenlog.Successf("Success message with %s", "formatting")
zenlog.Warningf("Warning message with %s", "formatting")
zenlog.Errorf("Error message with %s", "formatting")
zenlog.Fatalf("Fatal message with %s", "formatting") // Exits with code 1

Set custom time format

zenlog.SetTimeFormat("YOUR TIME FORMAT") // Default: 2006-01-02 15:04:05

Available time formats

Made with VHS

Set debug mode

zenlog.SetDebug(true) // Default: false

Toggle report caller

zenlog.SetReportCaller(true) // Default: false

Made with VHS

About

A minimalist logging library for Go.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages