Skip to content

Nutdat/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ Nut Logger

A simple, colorful logging library for Go โ€” logs to files and console.


โš™๏ธ Features

  • ๐Ÿ“ File logging with rotation
  • ๐Ÿ–ฅ๏ธ Console logging with colors
  • ๐Ÿ“ฆ Log levels: INFO, WARN, ERROR, FATAL
  • ๐Ÿงน Auto cleanup of old logs
  • ๐Ÿงฉ Module-based console output

๐Ÿš€ Usage

Import

import "github.com/Nutdat/logger"

Log to File

logger.Info("App started")
logger.Warn("Low disk space")
logger.Error("DB connection failed")
logger.Fatal("Out of memory")

Log to Console

logger.Console("SQL", "SELECT * FROM users")

or Init

(different color)

logger.LogInit("INIT", "Cache initialized")

JSON Print

logger.PrettyPrintJSON(interface)

clean up all old logs

logger.Cleanup(7) // Keep logs from last 7 months

About

nut for logger

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages