Go-micro: [FEATURE] Add the possibility to use another Logger

Created on 7 Jan 2020  路  3Comments  路  Source: asim/go-micro

Is your feature request related to a problem? Please describe.
Add the possibility to use your own logger or another logger like logrus.

Logrus is very good for micro-services, in particular, to add fields.

It's very annoying to have two different log lines like this:

INFO[2020-01-07T21:20:13.754] start service      status=test
2020-01-07 21:20:13.763897 I | Listening on [::]:41921
^C2020-01-07 21:20:17.654143 I | Received signal interrupt
2020-01-07 21:20:17.655124 I | Stopping

Describe the solution you'd like
An option Logger that can be set when defining the microservice, or another better solution ?.

Like:

service := micro.NewService(
    micro.Name("service"),
    micro.Logger(DEFINE_LOGGER_HERE),
)

Most helpful comment

try to use latest release of micro v2

All 3 comments

Hi,

You can do that.

import "github.com/micro/go-micro/util/log"

log.SetLogger(YourNewLogger)

YourNewLogger must implement the interface of go-log

for structured logger please wait next few days, micro logger is updating to support any structure logger via interface

try to use latest release of micro v2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aimpsmile picture aimpsmile  路  9Comments

Wintereise picture Wintereise  路  6Comments

hb-chen picture hb-chen  路  5Comments

djensen47 picture djensen47  路  8Comments

5teven picture 5teven  路  5Comments