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

Side by Side Diff: go/src/infra/libs/logging/go-logging.go

Issue 1149313002: go: Replace Logrus with go-logging. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: typo Created 5 years, 7 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 | « go/src/infra/libs/logging/appengine.go ('k') | go/src/infra/libs/logging/logging.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // +build !appengine
6
7 package logging
8
9 import (
10 "os"
11
12 "github.com/op/go-logging"
13 )
14
15 const fmt string = "%{color}[P%{pid} %{time:15:04:05.000} %{shortfile} %{level:. 4s} %{id:03x}]%{color:reset} %{message}"
16
17 type logger struct {
18 l *logging.Logger
19 }
20
21 func (l *logger) Infof(format string, args ...interface{}) { l.l.Info(format, args...) }
22 func (l *logger) Warningf(format string, args ...interface{}) { l.l.Warning(form at, args...) }
23 func (l *logger) Errorf(format string, args ...interface{}) { l.l.Error(format , args...) }
24
25 func init() {
26 backend := logging.NewLogBackend(os.Stdout, "", 0)
27 formatted := logging.NewBackendFormatter(backend, logging.MustStringForm atter(fmt))
28 logging.SetBackend(formatted)
29
30 log := &logger{logging.MustGetLogger("")}
31 log.l.ExtraCalldepth = 1 // one layer of wrapping in logger struct above
32 DefaultLogger = log
33 }
OLDNEW
« no previous file with comments | « go/src/infra/libs/logging/appengine.go ('k') | go/src/infra/libs/logging/logging.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698