Skip to content

Latest commit

 

History

History

logrus

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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")
}