v4.9.0
版本发布时间: 2022-09-29 23:04:24
micro/go-micro最新发布版本:v5.3.0(2024-07-09 01:50:30)
New Features
This release allows you to set a logger per component (interface). This is, for example, useful if you want to set a logger with separate fields per component, to filter your logs e.g.
Be aware that if you want to set one logger for all components, OR a default logger for the components, you still need to manually assign your logger to logger.DefaultLogger
. However, you can now overwrite the use of the default logger with options.
import log "go-micro.dev/v4/logger"
// This logger will be used by all services that don't have a logger set explicitly
log.DefaultLogger = dLogger
// Create service
srv := micro.NewService(
...
// This logger will only be used by the service component, it is not passed on to other components
micro.Logger(logger),
micro.Broker(
broker.NewBroker(
broker.Logger(bLogger),
),
),
micro.Registry(
registry.NewRegistry(
registry.Logger(rLogger),
),
),
)
What's Changed
- fix: prevent returning invalid empty strings for memory store list by @dbereza-machinify in https://github.com/go-micro/go-micro/pull/2553
- feat(config): add withFS option to file source by @asynxc in https://github.com/go-micro/go-micro/pull/2557
- docs: update README shields by @Davincible in https://github.com/go-micro/go-micro/pull/2558
- feat(logger): add logger option to all micro components (override DefaultLogger) closes #2556 by @asynxc in https://github.com/go-micro/go-micro/pull/2559
New Contributors
- @asynxc made their first contribution in https://github.com/go-micro/go-micro/pull/2557
Full Changelog: https://github.com/go-micro/go-micro/compare/v4.8.1...v4.9.0