Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

big-squid/go-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

As outlined in https://blog.golang.org/using-go-modules add

import (
  ...
  "github.com/big-squid/go-logging"
  ...
)

to your project and run go mod tidy or a build.

Examples

package main

import (
  "github.com/big-squid/go-logging"
)

var logger logging.Logger

func init() {
  logger = logging.New("main", logging.DEBUG, nil)
  logger.EnvConfig("LOG_CONFIG")
}

func counter() {
  log := logger.New("counter")
  for i := 0; i < 5; i++ {
    log.Warn("Loop %v", i)
  }
  log.Fatal("done")
}

func main() {
  log := logger
  log.Trace("This will only appear if the level is TRACE")
  log.Debug("Debug msg")
  log.Info("Info msg")

  counter()
}

About

Golang leveled/layer logger.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages