1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-04 21:42:57 +02:00

fix: some linting issues (#2563)

This commit is contained in:
David Brouwer
2022-09-30 16:27:07 +02:00
committed by GitHub
parent 47e6a8d725
commit 85c0b0b8eb
221 changed files with 1025 additions and 1283 deletions

View File

@ -27,7 +27,7 @@ type defaultLogger struct {
opts Options
}
// Init (opts...) should only overwrite provided options
// Init (opts...) should only overwrite provided options.
func (l *defaultLogger) Init(opts ...Option) error {
for _, o := range opts {
o(&l.opts)
@ -183,7 +183,7 @@ func (l *defaultLogger) Options() Options {
return opts
}
// NewLogger builds a new logger based on options
// NewLogger builds a new logger based on options.
func NewLogger(opts ...Option) Logger {
// Default options
options := Options{

View File

@ -116,7 +116,7 @@ func Fatalf(template string, args ...interface{}) {
os.Exit(1)
}
// Returns true if the given level is at or lower the current logger level
// Returns true if the given level is at or lower the current logger level.
func V(lvl Level, log Logger) bool {
l := DefaultLogger
if log != nil {

View File

@ -2,16 +2,16 @@
package logger
var (
// Default logger
// Default logger.
DefaultLogger Logger = NewLogger()
// Default logger helper
// Default logger helper.
DefaultHelper *Helper = NewHelper(DefaultLogger)
)
// Logger is a generic logging interface
// Logger is a generic logging interface.
type Logger interface {
// Init initialises options
// Init initializes options
Init(options ...Option) error
// The Logger options
Options() Options

View File

@ -20,28 +20,28 @@ type Options struct {
Context context.Context
}
// WithFields set default fields for the logger
// WithFields set default fields for the logger.
func WithFields(fields map[string]interface{}) Option {
return func(args *Options) {
args.Fields = fields
}
}
// WithLevel set default level for the logger
// WithLevel set default level for the logger.
func WithLevel(level Level) Option {
return func(args *Options) {
args.Level = level
}
}
// WithOutput set default output writer for the logger
// WithOutput set default output writer for the logger.
func WithOutput(out io.Writer) Option {
return func(args *Options) {
args.Out = out
}
}
// WithCallerSkipCount set frame count to skip
// WithCallerSkipCount set frame count to skip.
func WithCallerSkipCount(c int) Option {
return func(args *Options) {
args.CallerSkipCount = c