Skip to content

go-needle/log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪡log

A lightweight logging framework for golang

golang

introduction

This is a lightweight Golang logging framework that supports five isolation levels: DEBUG, INFO, WARN, ERROR, and FATAL.

installing

Select the version to install

go get github.com/go-needle/log@version

If you have already get , you may need to update to the latest version

go get -u github.com/go-needle/log

quickly start

package main

import (
	"fmt"
	"github.com/go-needle/log"
	"os"
)

func main() {
	file := log.File("log.txt")
	defer file.Close()
	// global singleton
	log.Debug("debug")
	log.Info("info")
	log.Warn("warn")
	log.Error("error")
	log.Set(log.ErrorLevel, file)
	log.Debug("debug")
	log.Error("error")
	log.Info("info")
	log.Warn("warn")
	
	// obj
	l := log.New()
	l.Debug("debug")
	l.Info("info")
	l.Warn("warn")
	l.Error("error")
	l.Set(log.ErrorLevel, file)
	l.Debug("debug")
	l.Info("info")
	l.Warn("warn")
	l.Error("error")
	l.Fatal("fatal")
}

About

A lightweight logging framework for golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages