You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bryan Joshua Pedini 8cc03b5e59 fixed example 6 months ago
LICENSE first commit 8 months ago
README.md fixed example 6 months ago
go.mod first code version 6 months ago
logger.go first code version 6 months ago
stringinarray.go first code version 6 months ago

README.md

Go Basic Logger

A basic logger written in Go so simple it's impossible to miss it.

Log levels

Level Alias Description
DEBUG DBG Debug information useful when programming
NOTICE NOT Notice information useful when requesting logs for errors/bugs
INFO INF Standard classic log level, general information that narrates the program execution
WARNING WRN Warning messages for non-blocking things that go wrong
ERROR ERR Error messages for non-blocking things that go wrong
CRITICAL CRT Critical messages it's mandatory to pay attention to, may be still non-blocking
FATAL FAT Fatal messages about things for which the program execution cannot continue

Examples

General usage:

package main

import gobasiclogger "git.bjphoster.com/b.pedini/go-basic-logger"

var logger gobasiclogger.Logger

func main() {
    logLevel := "DEBUG"
    logger = *new(gobasiclogger.Logger)
    logger.Initialize(&logLevel)
    logger.Debug("Program execution started")

    ...

    if err != nil {
        logger.Fatal("Received error during operation X:", err)
    }
}

Getting the Logger level from an environment variable (called LOGLEVEL, not customizable (yet)):

...

func main() {
    logger = *new(gobasiclogger.Logger)
    logger.Initialize(nil)

    ...
}