landonia / golog

A simple log that will print using colours to a specific stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

golog

Go Report Card GoDoc

A wrapper for the go log providing namespaces and standard levels

Overview

The standard go log package provides the core writing methods but does not provide any colouring or level functions. This simply provides those features. You can overwrite the standard log on the package level if you require any different settings.

Installation

With a healthy Go Language installed, simply run go get github.com/landonia/golog

Example

  	package main

	import (
		"flag"
		"github.com/landonia/golog/prettylog"
	)

	func main() {
		log, err := prettylog.New(prettylog.WithNameSpace("mynamespace"))
    		if err != nil {
      			panic(err)
    		}

		// Setup application.....
		log.Info("Application has started successfully..")

		// .. something goes wrong
		log.Error("Whoops")
	}

Out of Box Example

simply run go run $GOPATH/src/github.com/landonia/golog/cmd/example.go

You should see output to the following:

Example output

About

golog was written by Landon Wainwright | GitHub.

Follow me on Twitter @landotube! Although I don't really tweet much tbh.

About

A simple log that will print using colours to a specific stream

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 100.0%