Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 717 Bytes

README.md

File metadata and controls

43 lines (27 loc) · 717 Bytes

Hertz Logrus (This is a community driven project)

Introduction

This is a logger library that uses logrus to implement the Hertz logger interface

Usage

Download and install it:

go get github.com/hertz-contrib/logger/logrus

Import it in your code:

import hertzlogrus github.com/hertz-contrib/logger/logrus

Simple Example:

package main

import (
	"context"

	"github.com/cloudwego/hertz/pkg/common/hlog"
	hertzlogrus "github.com/hertz-contrib/logger/logrus"
)

func main() {
	logger := hertzlogrus.NewLogger()
	hlog.SetLogger(logger)

	...

	hlog.CtxInfof(context.Background(), "hello %s", "hertz")
}