Go-zla - Zerolog adapter to go-facades logger interface

GO-ZLA

Go Reference license Build Status Code Coverage Scrutinizer Code Quality

GO ZeroLog Adapter (a.k.a. go-zla) is a lightweight Golang module that adapt the use of the zerolog logger to a standard interface provided by the go-facades project.

General

Details of the standard interface could be found HERE

Usage This example program shows the initialization and the use of some levels and features:

package zla_test

import (
	"fmt"
	"time"

	"github.com/cdleo/go-e2h"
	"github.com/cdleo/go-zla"
)

func bar() error {
	return e2h.Trace(fmt.Errorf("foo"))
}

func Example_logger() {

	logger, _ := zla.NewLogger()

	//We've set this time func in order to always get the same time in the logger output
	mockedDateTime := time.Date(2021, 05, 21, 9, 00, 00, 000000000, time.UTC)
	logger.SetTimestampFunc(mockedDateTime.Local)

	//By default, the logger in fully initialized with level Info and writes to StdOutput
	logger.Info("Log this!")

	reqId := "ad7ec2d7-d92d-4d02-a937-e0c477611ffd"
	logger.WithRefID(reqId).Error(bar(), "This is an error log!")

	// Output:
	// {"time":"2021-05-21T06:00:00-03:00","level":"INFO","message":"Log this!","where":"aca"}
	// {"time":"2021-05-21T06:00:00-03:00","ref":"ad7ec2d7-d92d-4d02-a937-e0c477611ffd","level":"ERROR","message":"This is an error log!","where":"aca","details":{"error":"foo","stack_trace":[{"func":"github.com/cdleo/go-zla_test.bar","caller":"zla_example_test.go:12"}]}}

}

Sample

You can find a sample of the use of go-zla project HERE

Contributing

Comments, suggestions and/or recommendations are always welcomed. Please check the Contributing Guide to learn how to get started contributing.

Owner
Christian Leo
I'm father, husband, developer and ST Fan. I really love (and enjoy) challenges.
Christian Leo
Similar Resources

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

Loggly Hooks for GO Logrus logger

Loggly Hooks for Logrus Usage package main import ( "github.com/sirupsen/logrus" "github.com/sebest/logrusly" ) var logglyToken string = "YOUR_LOG

Sep 26, 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

A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.

A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.

SQLDB-Logger A logger for Go SQL database driver without modify existing *sql.DB stdlib usage. Colored console writer output above only for sample/dev

Jan 3, 2023

xlog is a logger for net/context aware HTTP applications

xlog is a logger for net/context aware HTTP applications

⚠️ Check zerolog, the successor of xlog. HTTP Handler Logger xlog is a logger for net/context aware HTTP applications. Unlike most loggers, xlog will

Sep 26, 2022

Zero Allocation JSON Logger

Zero Allocation JSON Logger

Zero Allocation JSON Logger The zerolog package provides a fast and simple logger dedicated to JSON output. Zerolog's API is designed to provide both

Jan 1, 2023

A powerful zero-dependency json logger.

ZKits Logger Library About This package is a library of ZKits project. This is a zero-dependency standard JSON log library that supports structured JS

Dec 14, 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
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

Nov 28, 2021
A logr LogSink implementation using Zerolog

Zerologr A logr LogSink implementation using Zerolog. Usage import ( "os" "github.com/go-logr/logr" "github.com/hn8/zerologr" "github

Nov 17, 2022
Logger - Simple logger without written with std pkg

Go-Logger Simple usage is: package main

Jan 2, 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
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
Log-server - Implement log server for gwaylib/log/adapter/rmsq

Implement server of github.com/gwaylib/log Base on https://github.com/gwaycc/lserver Build . env.sh cd cmd/web go build Deploy Install supd(Debian sy

Jan 3, 2022
Mango-coral - Coral adapter for mango

mango-coral coral adapter for mango. Example import ( "fmt" mcoral "github.co

Jul 28, 2022
Gin adapter for standard net/http middleware

midgin An adapter to use standard net/http middleware in Gin. Overview Gin is a very capable web framework, but it does not directly support standard

Feb 12, 2022