Categorygithub.com/tcpcon/GoLog
modulepackage
0.0.0-20230526155908-70c8d511d2e9
Repository: https://github.com/tcpcon/golog.git
Documentation: pkg.go.dev

# README

GoLog

Simplistic golang log package.

Functions

func SetLevel(lvl Level)
func SetPath(p string) // set path to log dir for logging to file

func EnableLogToFile()
func DisableLogToFile()
func EnableLogToMsg()
func DisableLogToMsg()

func Debug(format string, args ...any) Log
func Info(format string, args ...any) Log
func Warn(format string, args ...any) Log
func Error(format string, args ...any) Log
func Fatal(format string, args ...any) Log

func (l Log) Msg() // log to stdout/stderr
func (l Log) File() // log to file
func (l Log) Full() // log to stdout/stderr then file (if allowed)

Info

  • Log functions will format string with args such as fmt.Printf in every case except below
  • If the last argument to a log function is of type log.Params (map[string]any) the output will format log.Params and append it to the log message, see example below
log.Debug("Hello, %s", "World", log.Params{"time": "3pm", "afternoon": true}).Msg()

example_1

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author