Skip to content

qmsk/go-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

The zero-valued logging.Logging struct functions as a no-op logger that does not output anything.

mypackage/logging.go

package mypackage

import (
    "github.com/qmsk/go-logging"
)

var log logging.Logging

func SetLogging(l logging.Logging) {
    log = l
}

cmd/mycmd/main.go

import (
    "github.com/qmsk/go-logging"
    "flag"
    ".../mypackage"
)

var LoggingOptions logging.Options

func init() {
  LoggingOptions.InitFlags()
}

func main() {
  flag.Parse()

  mypackage.SetLogging(LoggingOptions.MakeLogging())

  ...
}

About

Trivial logging package for Go libraries

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages