You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
470 B
23 lines
470 B
package verbosity
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitoa.ru/go-4devs/console/output"
|
|
)
|
|
|
|
func Verb(out output.Output, verb output.Verbosity) output.Output {
|
|
return func(ctx context.Context, v output.Verbosity, msg string, kv ...output.KeyValue) (int, error) {
|
|
if verb >= v {
|
|
return out(ctx, v, msg, kv...)
|
|
}
|
|
|
|
return 0, nil
|
|
}
|
|
}
|
|
|
|
func Quiet() output.Output {
|
|
return func(context.Context, output.Verbosity, string, ...output.KeyValue) (int, error) {
|
|
return 0, nil
|
|
}
|
|
}
|
|
|