Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - pieterclaerhout/go-log: A logging library with strack traces, object dumping and optional timestamps

A logging library with strack traces, object dumping and optional timestamps - pieterclaerhout/go-log

Visit SiteGitHub - pieterclaerhout/go-log: A logging library with strack traces, object dumping and optional timestamps

GitHub - pieterclaerhout/go-log: A logging library with strack traces, object dumping and optional timestamps

A logging library with strack traces, object dumping and optional timestamps - pieterclaerhout/go-log

Powered by 0x5a.live ๐Ÿ’—

go-log

Build Status Go Report Card Documentation license GitHub version GitHub issues

This is a Golang library with logging related functions which I use in my different projects.

Usage

package main

import (
    "github.com/pieterclaerhout/go-log"
)

func main() {

    log.DebugMode = true
    log.PrintTimestamp = true
    log.PrintColors = true
    log.TimeFormat = "2006-01-02 15:04:05.000"

    myVar := map[string]string{"hello": "world"}

    log.Debug("arg1", "arg2")
    log.Debugf("arg1 %d", 1)
    log.DebugDump(myVar, "prefix")
    log.DebugSeparator("title")

    log.Info("arg1", "arg2")
    log.Infof("arg1 %d", 1)
    log.InfoDump(myVar, "prefix")
    log.InfoSeparator("title")

    log.Warn("arg1", "arg2")
    log.Warnf("arg1 %d", 1)
    log.WarnDump(myVar, "prefix")
    log.WarnSeparator("title")

    log.Error("arg1", "arg2")
    log.Errorf("arg1 %d", 1)
    log.ErrorDump(myVar, "prefix")
    log.ErrorSeparator("title")

    log.Fatal("arg1", "arg2")
    log.Fatalf("arg1 %d", 1)

    err1 := funcWithError()
    log.StackTrace(err1)

    err2 := funcWithError()
    log.CheckError(err2)

}

Environment variables

The defaults are taken from the environment variables:

  • DEBUG: log.DebugMode
  • PRINT_TIMESTAMP: log.PrintTimestamp

GoLang Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.