Skip to content
This repository has been archived by the owner on Dec 2, 2018. It is now read-only.

zeebo/taglog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Taglog implementes tagged based logging for go.

Example:

package main

import (
	"github.com/zeebo/taglog"
	"log"
	"os"
)

var stdlog = log.New(os.Stderr, "", LstdFlags)

func main() {
	logger := taglog.New(stdlog)

	logger.Enable("debug")
	logger.Enable("feature")

	logger.Print("debug, other_tag", "Some statement") //prints
	logger.Print("other_tag", "Won't work!") //no tags match so no print
	logger.Print("debug, feature", "Debugging some feature") //prints once

	logger.Disable("debug")
	logger.Print("debug", "I hope you know this wont print!")
	logger.Print("feature", "But this will :)")
}

Coming soon is a way to enable/disable tags based on command line arguments in a standard way.

About

Tagged based logging for Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages