@ -1,5 +1,7 @@
package log
package log
import "context"
// FilterOption is filter option.
// FilterOption is filter option.
type FilterOption func ( * Filter )
type FilterOption func ( * Filter )
@ -39,6 +41,7 @@ func FilterFunc(f func(level Level, keyvals ...interface{}) bool) FilterOption {
// Filter is a logger filter.
// Filter is a logger filter.
type Filter struct {
type Filter struct {
ctx context . Context
logger Logger
logger Logger
level Level
level Level
key map [ interface { } ] struct { }
key map [ interface { } ] struct { }
@ -67,6 +70,9 @@ func (f *Filter) Log(level Level, keyvals ...interface{}) error {
// prefixkv contains the slice of arguments defined as prefixes during the log initialization
// prefixkv contains the slice of arguments defined as prefixes during the log initialization
var prefixkv [ ] interface { }
var prefixkv [ ] interface { }
l , ok := f . logger . ( * logger )
l , ok := f . logger . ( * logger )
if ok {
l . ctx = f . ctx
}
if ok && len ( l . prefix ) > 0 {
if ok && len ( l . prefix ) > 0 {
prefixkv = make ( [ ] interface { } , 0 , len ( l . prefix ) )
prefixkv = make ( [ ] interface { } , 0 , len ( l . prefix ) )
prefixkv = append ( prefixkv , l . prefix ... )
prefixkv = append ( prefixkv , l . prefix ... )