update input/outpu
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
13
output/verbosity/verbosity.go
Normal file
13
output/verbosity/verbosity.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package verbosity
|
||||
|
||||
//go:generate stringer -type=Verbosity -linecomment
|
||||
|
||||
type Verbosity int
|
||||
|
||||
const (
|
||||
Quiet Verbosity = iota - 1 // quiet
|
||||
Norm // norm
|
||||
Info // info
|
||||
Debug // debug
|
||||
Trace // trace
|
||||
)
|
||||
28
output/verbosity/verbosity_string.go
Normal file
28
output/verbosity/verbosity_string.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by "stringer -type=Verbosity -linecomment"; DO NOT EDIT.
|
||||
|
||||
package verbosity
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[Quiet - -1]
|
||||
_ = x[Norm-0]
|
||||
_ = x[Info-1]
|
||||
_ = x[Debug-2]
|
||||
_ = x[Trace-3]
|
||||
}
|
||||
|
||||
const _Verbosity_name = "quietnorminfodebugtrace"
|
||||
|
||||
var _Verbosity_index = [...]uint8{0, 5, 9, 13, 18, 23}
|
||||
|
||||
func (i Verbosity) String() string {
|
||||
i -= -1
|
||||
if i < 0 || i >= Verbosity(len(_Verbosity_index)-1) {
|
||||
return "Verbosity(" + strconv.FormatInt(int64(i+-1), 10) + ")"
|
||||
}
|
||||
return _Verbosity_name[_Verbosity_index[i]:_Verbosity_index[i+1]]
|
||||
}
|
||||
Reference in New Issue
Block a user