outburst

package module
v0.0.0-...-7b95783 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2019 License: GPL-3.0 Imports: 7 Imported by: 1

README

Outburst logo - Lazy logging for golang

Outburst

Simple, light weight, lazy logging which gets out of your way.

I'm not looking to replace propper loggers like the impressive Logrus I'd recommend you consider it, but I think there is a need to have quick dirty and convienient logging - like outburst. Logging which:

  • is easy to set up and configure
  • shorter to use than fmt.Println()
  • has shiny colored fonts in the terminal
  • supports emojis if you want them
  • outputs to a file if/when needed

Start Here

  1. Get - as you would any other go package
go get github.com/areThereAnyUserNamesleft/outburst
  1. Import - consider using ob as a convienient alias
import ob "github.com/areThereAnyUserNamesLeft/outburst"

  1. Initiate - consider calling it log or whatever
	log := ob.NewOutBurst()
  1. Log - see examples

Example 1 - Key - Value logging:

	log.Out(ob.Knot{"Scooby Doo": Dog, "Age": 4}).Burst(ob.Info)

	// Or if you want an even shorter version!

	log.Info(ob.KV{"Scooby Doo": Dog, "Age": 4})

	// (Hint - Knot and KV are the same data structure)

Both the above give you some nice output in your logfile

Info [2019-03-30]-[15:40:31]- Scooby Doo:Dog -  Age:4

or some nicely colored loglines in the terminal Outburst logo - Lazy logging for golang Additionally, the output can be colored and have emojis to reflect the error.

Configured by a yaml file

The default settings are handled by a yaml file in your projects root - see outburst.yaml for an example.

Extra convienience functions -

Error Logging
log.ErrCheck(err, ob.KV{"Scooby Doo": Dog, "Age": 4})

// replaces

if err != nil {
    log.Error(cb.KV{"Error": err, "Scooby Doo":Dog, "Age": 4})
}

// The Knot/KV is an optional parameter so you can include them or not or include multiple.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOutBurst

func NewOutBurst() outburst

Types

type KV

type KV map[string]interface{}

type Knot

type Knot map[string]interface{}

type Level

type Level int
const (
	Trace Level = iota
	Debug
	Info
	Warn
	Error
	Fatal
	Panic
)

func (Level) String

func (l Level) String() string

type Line

type Line struct {
	Knots       Knot
	Time        string
	Level       Level
	EmojiChoice string
	Emoji       string
	Color       *color.Color
	File        string
}

func (Line) Burst

func (l Line) Burst(lvl Level)

Burst takes a map of string interface and returns a logging line

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL