Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 820 Bytes

README.md

File metadata and controls

39 lines (30 loc) · 820 Bytes

logger

Logger written in Go

Installation

Add package to your Go project

go get github.com/Pilladian/logger

Example

package main

import "github.com/Pilladian/logger"

func main() {
    // Possible log level between 0-2
    // [0] Errors are getting logged,
    // [1] Errors and Warnings are getting logged,
    // [2] Errors, Warnings and Infos are getting logged
    logger.SetLogLevel(2)

    // Set filename for logging output 
    // default: "" (logs will be written to std.out)
    logger.SetLogFilename("./output.log")

    // Log Info
    logger.Info("Some Info to log")

    // Log Warning
    logger.Warning("Some Warning to log")

    // Log Error
    logger.Error("Some Error to log")
    
    // Log Error and exit with status code 1
    logger.Fatal("Some Error to log")
}