17twenty / logsip

A short, concise, colorful logger for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logsip

A simple, concise, colorful logger for Go.

How to use

First, read the source code. It's REALLY simple. Here's a screenshot:

Just a screenshot here, nothin' to see

And here's how you use it:

package main

import (
    "os"

    "github.com/iamthemuffinman/logsip"
)

var log = logsip.New(os.Stdout)

func main() {
    log.Info("Just some info for ya")
    log.Warn("Some info you might need to know")
    log.Fatal("You done did something wrong")
    log.Panic("You REALLY done did something wrong")
    
    lulz := "lulz"

    log.Infof("Just some %s for ya", lulz)
    log.Warnf("You might need to know this %s", lulz)
    log.Fatalf("You done did the %s", lulz)
    log.Panicf("You REALLY done did the %s", lulz)
    
    log.Infoln("Just some info for ya")
    log.Warnln("Some info you might need to know")
    log.Fatalln("You done did something wrong")
    log.Panicln("You REALLY done did something wrong")
}

New() will write to anything that satisfies the io.Writer method so get creative!

Logsip also provides a Default option if you just want to use os.Stdout:

package main

import (
    "github.com/iamthemuffinman/logsip"
)

var log = logsip.Default()

func main() {
    log.Info("Just some info for ya")
}

Contributions welcome!

Credits

Thanks to Go for being awesome and thanks to fatih for his color library which you can find here!

About

A short, concise, colorful logger for Go

License:MIT License


Languages

Language:Go 100.0%