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

Unified Diff: common/logging/fields.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/logging/exported.go ('k') | common/logging/fields_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/logging/fields.go
diff --git a/common/logging/fields.go b/common/logging/fields.go
index 9b1dbbbf85e13e0cd545f671fe4ae29418f59d0d..07f46064be0d1efb0dd4ecb3f19c37b6347478b4 100644
--- a/common/logging/fields.go
+++ b/common/logging/fields.go
@@ -62,31 +62,24 @@ func (f Fields) Copy(other Fields) Fields {
// SortedEntries processes a Fields object, pruning invisible fields, placing
// the ErrorKey field first, and then sorting the remaining fields by key.
-//
-// If prune is true, internally-used field keys will be pruned from the output
-// if present.
-func (f Fields) SortedEntries(prune bool) (s []*FieldEntry) {
+func (f Fields) SortedEntries() (s []*FieldEntry) {
if len(f) == 0 {
return nil
}
s = make([]*FieldEntry, 0, len(f))
for k, v := range f {
- if !(prune && k == FilterOnKey) {
- s = append(s, &FieldEntry{k, v})
- }
+ s = append(s, &FieldEntry{k, v})
}
sort.Sort(fieldEntrySlice(s))
return
}
-// FieldString returns a string describing the contents of f in a sorted,
+// String returns a string describing the contents of f in a sorted,
// dictionary-like format.
-//
-// If prune is true, pruned fields will be omitted from the resulting string.
-func (f Fields) FieldString(prune bool) string {
+func (f Fields) String() string {
b := bytes.Buffer{}
b.WriteRune('{')
- for idx, e := range f.SortedEntries(prune) {
+ for idx, e := range f.SortedEntries() {
if idx > 0 {
b.WriteString(", ")
}
@@ -96,12 +89,6 @@ func (f Fields) FieldString(prune bool) string {
return b.String()
}
-// String returns a full string representation of Fields. This should not be
-// used for logging otuput, as it doesn't prune fields.
-func (f Fields) String() string {
- return f.FieldString(false)
-}
-
// Debugf is a shorthand method to call the current logger's Errorf method.
func (f Fields) Debugf(c context.Context, fmt string, args ...interface{}) {
Get(SetFields(c, f)).LogCall(Debug, 1, fmt, args)
« no previous file with comments | « common/logging/exported.go ('k') | common/logging/fields_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698