| Index: appengine/gaelogger/logger.go
|
| diff --git a/appengine/gaelogger/logger.go b/appengine/gaelogger/logger.go
|
| deleted file mode 100644
|
| index 24ba98a9b4ac6538ebb941cf751088074d879841..0000000000000000000000000000000000000000
|
| --- a/appengine/gaelogger/logger.go
|
| +++ /dev/null
|
| @@ -1,67 +0,0 @@
|
| -// Copyright 2015 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -package gaelogger
|
| -
|
| -import (
|
| - "fmt"
|
| -
|
| - "github.com/luci/luci-go/common/logging"
|
| - "golang.org/x/net/context"
|
| - "google.golang.org/appengine/log"
|
| -)
|
| -
|
| -// Use adds a logging.Logger implementation to the context which logs to
|
| -// appengine's log handler.
|
| -func Use(c context.Context) context.Context {
|
| - return logging.SetFactory(c, func(ic context.Context) logging.Logger {
|
| - return &loggerImpl{ic}
|
| - })
|
| -}
|
| -
|
| -type loggerImpl struct {
|
| - c context.Context
|
| -}
|
| -
|
| -func (gl *loggerImpl) Debugf(format string, args ...interface{}) {
|
| - gl.LogCall(logging.Debug, 1, format, args)
|
| -}
|
| -func (gl *loggerImpl) Infof(format string, args ...interface{}) {
|
| - gl.LogCall(logging.Info, 1, format, args)
|
| -}
|
| -func (gl *loggerImpl) Warningf(format string, args ...interface{}) {
|
| - gl.LogCall(logging.Warning, 1, format, args)
|
| -}
|
| -func (gl *loggerImpl) Errorf(format string, args ...interface{}) {
|
| - gl.LogCall(logging.Error, 1, format, args)
|
| -}
|
| -
|
| -// TODO(riannucci): prefix with caller's code location.
|
| -func (gl *loggerImpl) LogCall(l logging.Level, calldepth int, format string, args []interface{}) {
|
| - if gl.c == nil || !logging.IsLogging(gl.c, l) {
|
| - return
|
| - }
|
| -
|
| - var logf func(context.Context, string, ...interface{})
|
| - switch l {
|
| - case logging.Debug:
|
| - logf = log.Debugf
|
| - case logging.Info:
|
| - logf = log.Infof
|
| - case logging.Warning:
|
| - logf = log.Warningf
|
| -
|
| - case logging.Error:
|
| - fallthrough
|
| - default:
|
| - logf = log.Errorf
|
| - }
|
| -
|
| - fields := logging.GetFields(gl.c)
|
| - if len(fields) > 0 {
|
| - logf(gl.c, "%s :: %s", fmt.Sprintf(format, args...), fields.FieldString(true))
|
| - } else {
|
| - logf(gl.c, format, args...)
|
| - }
|
| -}
|
|
|