Skip to content

theiny/slog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

SLOG - Simple Log for Go

A simple Golang package for printing colourised log statements, with an option to configure the log level to control output.

Install

go get -u github.com/theiny/slog

Example

package main

import (
  log "github.com/theiny/slog"
)

func main() {

	log.Debug("Some extra information that you want to hide sometimes because it's flooding your console or log storage.")

	log.Info("Some useful information")

	log.Error("An error message of some sort")
  
}

log output

Set Log Level

By default, the log level is set to DEBUG when initialized. If you want to set it to a different level:

In code:

log.SetLevel("ERROR")

or via environment variable:

LOG_LEVEL: "ERROR"

Log Levels

You can suppress the log layers by setting the appropriate log level e.g. setting it to ERROR will only print error statements, setting it to INFO will print error and info statements. DEBUG prints everything.

About

Simple log package for Go

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages