Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: common/logging/exported.go

Issue 1622553005: Remove log filtering and add stringsetflag. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: error on empty Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/logging/config.go ('k') | common/logging/fields.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package logging 5 package logging
6 6
7 import ( 7 import (
8 "golang.org/x/net/context" 8 "golang.org/x/net/context"
9 ) 9 )
10 10
11 // SetFilter sets the context's logging filter value.
12 func SetFilter(c context.Context, filter string) context.Context {
13 return SetField(c, FilterOnKey, filter)
14 }
15
16 // SetError returns a context with its error field set. 11 // SetError returns a context with its error field set.
17 func SetError(c context.Context, err error) context.Context { 12 func SetError(c context.Context, err error) context.Context {
18 return SetField(c, ErrorKey, err) 13 return SetField(c, ErrorKey, err)
19 } 14 }
20 15
21 // IsLogging tests whether the currently-configured logger is logging at the 16 // IsLogging tests whether the currently-configured logger is logging at the
22 // specified level. 17 // specified level.
23 func IsLogging(c context.Context, l Level) bool { 18 func IsLogging(c context.Context, l Level) bool {
24 return l >= GetLevel(c) 19 return l >= GetLevel(c)
25 } 20 }
(...skipping 10 matching lines...) Expand all
36 31
37 // Warningf is a shorthand method to call the current logger's Errorf method. 32 // Warningf is a shorthand method to call the current logger's Errorf method.
38 func Warningf(c context.Context, fmt string, args ...interface{}) { 33 func Warningf(c context.Context, fmt string, args ...interface{}) {
39 Get(c).LogCall(Warning, 1, fmt, args) 34 Get(c).LogCall(Warning, 1, fmt, args)
40 } 35 }
41 36
42 // Errorf is a shorthand method to call the current logger's Errorf method. 37 // Errorf is a shorthand method to call the current logger's Errorf method.
43 func Errorf(c context.Context, fmt string, args ...interface{}) { 38 func Errorf(c context.Context, fmt string, args ...interface{}) {
44 Get(c).LogCall(Error, 1, fmt, args) 39 Get(c).LogCall(Error, 1, fmt, args)
45 } 40 }
OLDNEW
« no previous file with comments | « common/logging/config.go ('k') | common/logging/fields.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698