Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
/ gomol Public archive

Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs

License

Notifications You must be signed in to change notification settings

aphistic/gomol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gomol

GoDoc Build Status Code Coverage

Gomol (Go Multi-Output Logger) is an MIT-licensed Go logging library. The documentation and test coverage at this point is thin but will be improving over time.

Features

  • Multiple outputs at the same time

Installation

The recommended way to install is via http://gopkg.in

go get gopkg.in/aphistic/gomol.v0
...
import "gopkg.in/aphistic/gomol.v0"

Gomol can also be installed the standard way as well

go get github.com/aphistic/gomol
...
import "github.com/aphistic/gomol"

Examples

For brevity a lot of error checking has been omitted, be sure you do your checks!

This is a super basic example of adding a number of loggers and then logging a few messages:

package main

import (
	"github.com/aphistic/gomol"
)

func main() {
	consoleCfg := gomol.NewConsoleLoggerConfig()
	gomol.AddLogger(gomol.NewConsoleLogger(consoleCfg))
	gomol.AddLogger(gomol.NewLogglyLogger("1234"))
	gelfCfg := gomol.NewGelfLoggerConfig()
	gelfCfg.Hostname = "localhost"
	gelfCfg.Port = 12201
	gomol.AddLogger(gomol.NewGelfLogger(gelfCfg))

	gomol.SetAttr("facility", "gomol.example")
	gomol.SetAttr("another_attr", 1234)

	gomol.InitLoggers()
	defer gomol.ShutdownLoggers()

	for idx := 1; idx <= 10; idx   {
		gomol.Dbgm(map[string]interface{}{
			"msg_attr1": 4321,
		}, "Test message %v", idx)
	}
}

About

Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages