Convenient Logger interface and std logger wrapper

Convenient logger interface and wrapper around std logger

Interface

type Logger interface {
	Error(err error)
	Debugf(format string, args ...interface{})
	Noticef(format string, args ...interface{})
}

Usage with std logger

Ideal to use with Kubernates where you usually write logs to stdout and stderr. method Error will write to stderr and methods Debugf and Noticef will write to stdout. Debugf writes only in glog.Dev environment and Error and Noticef both in glog.Dev and glog.Prod.

lg := glog.NewStdoutLogger(glog.Dev, "my-service")

lg.Error(errors.New("some error"))
lg.Debugf("Something to debug %s", "foo")
lg.Noticef("Something to debug %s", "foo")

Null logger

lg := glog.NullLogger{}

// nothing will be written
lg.Error(errors.New("some error"))
lg.Debugf("Something to debug %s", "foo")
lg.Noticef("Something to debug %s", "foo")
Owner
Similar Resources

A feature-rich and easy to use logger for golang

A feature-rich and easy to use logger for golang

A feature-rich and easy to use logger for golang 🚀 Install 🌲 Common Logs lumber.Success() lumber.Info() lumber.Debug() lumber.Warning()

Dec 31, 2022

A minimal and extensible structured logger

⚠️ PRE-RELEASE ⚠️ DO NOT IMPORT THIS MODULE YOUR PROJECT WILL BREAK package log package log provides a minimal interface for structured logging in ser

Jan 7, 2023

🪵 A dead simple, pretty, and feature-rich logger for golang

🪵 A dead simple, pretty, and feature-rich logger for golang

🪵 lumber 🪵 A dead simple, pretty, and feature-rich logger for golang 🚀 Install 🌲 Logging Functions lumber.Success() lumber.Info() lumber.Debug() l

Jul 20, 2022

logger wraps uber/zap and trace with opentelemetry

logger 特性 支持 uber/zap 日志 支持 log rolling,使用 lumberjace 支持日志追踪 支持debug、info、warn、e

Sep 17, 2022

A simple and super power logger for golang

A simple and super power logger for golang

The most powerfull and faster logger for golang powered by DC 🤔 What is this? W

Oct 18, 2022

This package enables json output, level logging and so on to standard go logger.

logplug This package enables json output, level logging and so on to standard logger. Usage log.SetOutput(logplug.NewJSONPlug(os.Stderr, logplug.LogF

Dec 27, 2021

Goal is to generate logger and tracer wraps around a certain struct

Goal is to generate logger and tracer wraps around a certain struct

Goal is to generate logger and tracer wraps around a certain struct

Feb 13, 2022

A logger, for Go

Go-Log A logger, for Go! It's sort of log and code.google.com/p/log4go compatible, so in most cases can be used without any code changes. Breaking cha

Oct 7, 2022

Simple logger for Go programs. Allows custom formats for messages.

Simple logger for Go programs. Allows custom formats for messages.

go-logger A simple go logger for easy logging in your programs. Allows setting custom format for messages. Preview Install go get github.com/apsdehal/

Dec 17, 2022
Multi-level logger based on go std log

mlog the mlog is multi-level logger based on go std log. It is: Simple Easy to use NOTHING ELSE package main import ( log "github.com/ccpaging/lo

May 18, 2022
Logger - A thin wrapper of uber-go/zap logger for personal project

a thin wraper of uber-go/zap logger for personal project 0. thanks uber-go/zap B

Sep 17, 2022
A customized GORM logger that implements the appropriate interface and uses Logrus to output logs

CryptoMath GORM Logger A customized GORM logger that implements the appropriate interface and uses Logrus to output logs. Install go get github.com/ma

Nov 6, 2021
Binalyze logger is an easily customizable wrapper for logrus with log rotation

logger logger is an easily customizable wrapper for logrus with log rotation Usage There is only one function to initialize logger. logger.Init() When

Oct 2, 2022
Go logger interface adapter

Glog glog is an abstraction for various Go language log libraries. The Logger interface is in maintenance-mode to prevent broken changes to projects b

Nov 17, 2021
Logger - Go language is interface-oriented to implement an asynchronous log writing program

logger日志库 1、安装 go get github.com/staryjie/logger@latest 2、使用 示例: package main import ( "github.com/staryjie/logger" "time" ) func initLogger(name,

Jan 4, 2022
Go-zla - Zerolog adapter to go-facades logger interface

GO-ZLA GO ZeroLog Adapter (a.k.a. go-zla) is a lightweight Golang module that ad

Feb 16, 2022
Golog is a logger which support tracing and other custom behaviors out of the box. Blazing fast and simple to use.

GOLOG Golog is an opinionated Go logger with simple APIs and configurable behavior. Why another logger? Golog is designed to address mainly two issues

Oct 2, 2022
A 12-factor app logger built for performance and happy development
A 12-factor app logger built for performance and happy development

logxi log XI is a structured 12-factor app logger built for speed and happy development. Simpler. Sane no-configuration defaults out of the box. Faste

Nov 27, 2022
Dead simple, super fast, zero allocation and modular logger for Golang

Onelog Onelog is a dead simple but very efficient JSON logger. It is one of the fastest JSON logger out there. Also, it is one of the logger with the

Sep 26, 2022