adamveld12 / lopher

The simplest log API ever

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lopher

GoDoc Go Walker Gocover Go Report Card wercker status

A dead simple log library, inspired by Dave Cheney's blog post on logging.

Only two log levels exist: Info and Debug. Info is always enabled, Debug is for development time.

Included are the same flags that are available with the standard library log package, with an API that should feel familiar to you if you've used the standard library log package at all.

How to use

package main

import (
    "time"
    "os"
    "gopkg.in/adamveld12/lopher.v1"
)

func main(){
    // make a new instance:
    l := lopher.New(os.Stdout, false, lopher.LFstdFlags)

    started := time.Now()

    // mm/dd/yyyy hh:mm:ss /file/path/main.go [INFO] App started.\n
    l.Info("App started.")

    // Debug entries don't print unless you set DebugMode to true
    l.DebugMode(true)

    l.Debug("App is doing stuff")
    l.Debugf("App ran for %+v", time.Since(started))

    // Also included are package level functions with the same API as an instance
    lopher.Info("App Exiting")
}

Credits

Dave Cheney for being dope

License

MIT

About

The simplest log API ever

License:MIT License


Languages

Language:Go 100.0%