Skip to content

TelenorNorway/slf4go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Logging Facade fo Go (SLF4Go)

This module aims to provide a simple logging facade for Go. It is inspired by the Simple Logging Facade for Java (SLF4J). The goal is to provide a simple and efficient logging facade that can be used in Go applications to provide a consistent logging experience.

Usage

Get module.

go get github.com/telenornorway/slf4go

On application start, before calling any of the functions you must initialize a driver to use. This is done by calling slf4go.UseDriver with a driver that implements the slf4go.Driver interface. You can use a drive like Telelog to get started.

package main

import "github.com/telenornorway/slf4go"

func main() {
    var myDriver slf4go.Driver = some_driver.GetDriverSomehow()
    slf4go.UseDriver(myDriver)
    
    var log = slf4go.GetLogger()
    
    log.Info("Hello, %s!", "World")
}

Setting up Telelog would look something like this:

package main

import (
    "github.com/telenornorway/slf4go"
    "github.com/telenornorway/telelog"
)

func main() {
    telelog.Initialize(slf4go.UseDriver, telelog.DefaultConfig)
    
    var log = slf4go.GetLogger()
    
    log.Info("Hello, %s!", "World")
}

About

Simple Logging Facade for Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages