Skip to content

albertjin/log2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log2 for Go

To use this package. Create a log.go file as follows.

package __package name__

import (
    "github.com/albertjin/log2"
)

var critical = log2.Critical

var Logger = log2.NewStdLogger(nil)
var LogDebug = false

func log(a... interface{}) {
    Logger.Output(LogDebug, 1, a)
}

var stack = log2.StackLog

Example of logging code,

func hello() {
    log("hello") // This a simple logging. When LogDebug is false, the log is muted.
    log(critical, stack) // Regardless LogDebug or not, this is always logged.
    log(func() string {
        return "hello" // Some complex computation can be delayed or skipped.
    })
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages