// Copyright (c) 2020 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package log56import (7"context"8"time"910"github.com/sirupsen/logrus"11)1213// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.14func WithError(err error) *logrus.Entry {15return Log.WithError(err)16}1718// WithContext creates an entry from the standard logger and adds a context to it.19func WithContext(ctx context.Context) *logrus.Entry {20return Log.WithContext(ctx)21}2223// WithField creates an entry from the standard logger and adds a field to24// it. If you want multiple fields, use `WithFields`.25//26// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal27// or Panic on the Entry it returns.28func WithField(key string, value interface{}) *logrus.Entry {29return Log.WithField(key, value)30}3132// WithFields creates an entry from the standard logger and adds multiple33// fields to it. This is simply a helper for `WithField`, invoking it34// once for each field.35//36// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal37// or Panic on the Entry it returns.38func WithFields(fields logrus.Fields) *logrus.Entry {39return Log.WithFields(fields)40}4142// WithTime creats an entry from the standard logger and overrides the time of43// logs generated with it.44//45// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal46// or Panic on the Entry it returns.47func WithTime(t time.Time) *logrus.Entry {48return Log.WithTime(t)49}5051// Trace logs a message at level Trace on the standard logger.52func Trace(args ...interface{}) {53Log.Trace(args...)54}5556// Debug logs a message at level Debug on the standard logger.57func Debug(args ...interface{}) {58Log.Debug(args...)59}6061// Print logs a message at level Info on the standard logger.62func Print(args ...interface{}) {63Log.Print(args...)64}6566// Info logs a message at level Info on the standard logger.67func Info(args ...interface{}) {68Log.Info(args...)69}7071// Warn logs a message at level Warn on the standard logger.72func Warn(args ...interface{}) {73Log.Warn(args...)74}7576// Warning logs a message at level Warn on the standard logger.77func Warning(args ...interface{}) {78Log.Warning(args...)79}8081// Error logs a message at level Error on the standard logger.82func Error(args ...interface{}) {83Log.Error(args...)84}8586// Panic logs a message at level Panic on the standard logger.87func Panic(args ...interface{}) {88Log.Panic(args...)89}9091// Fatal logs a message at level Fatal on the standard logger then the process will exit with status set to 1.92func Fatal(args ...interface{}) {93Log.Fatal(args...)94}9596// Tracef logs a message at level Trace on the standard logger.97func Tracef(format string, args ...interface{}) {98Log.Tracef(format, args...)99}100101// Debugf logs a message at level Debug on the standard logger.102func Debugf(format string, args ...interface{}) {103Log.Debugf(format, args...)104}105106// Printf logs a message at level Info on the standard logger.107func Printf(format string, args ...interface{}) {108Log.Printf(format, args...)109}110111// Infof logs a message at level Info on the standard logger.112func Infof(format string, args ...interface{}) {113Log.Infof(format, args...)114}115116// Warnf logs a message at level Warn on the standard logger.117func Warnf(format string, args ...interface{}) {118Log.Warnf(format, args...)119}120121// Warningf logs a message at level Warn on the standard logger.122func Warningf(format string, args ...interface{}) {123Log.Warningf(format, args...)124}125126// Errorf logs a message at level Error on the standard logger.127func Errorf(format string, args ...interface{}) {128Log.Errorf(format, args...)129}130131// Panicf logs a message at level Panic on the standard logger.132func Panicf(format string, args ...interface{}) {133Log.Panicf(format, args...)134}135136// Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1.137func Fatalf(format string, args ...interface{}) {138Log.Fatalf(format, args...)139}140141// Traceln logs a message at level Trace on the standard logger.142func Traceln(args ...interface{}) {143Log.Traceln(args...)144}145146// Debugln logs a message at level Debug on the standard logger.147func Debugln(args ...interface{}) {148Log.Debugln(args...)149}150151// Println logs a message at level Info on the standard logger.152func Println(args ...interface{}) {153Log.Println(args...)154}155156// Infoln logs a message at level Info on the standard logger.157func Infoln(args ...interface{}) {158Log.Infoln(args...)159}160161// Warnln logs a message at level Warn on the standard logger.162func Warnln(args ...interface{}) {163Log.Warnln(args...)164}165166// Warningln logs a message at level Warn on the standard logger.167func Warningln(args ...interface{}) {168Log.Warningln(args...)169}170171// Errorln logs a message at level Error on the standard logger.172func Errorln(args ...interface{}) {173Log.Errorln(args...)174}175176// Panicln logs a message at level Panic on the standard logger.177func Panicln(args ...interface{}) {178Log.Panicln(args...)179}180181// Fatalln logs a message at level Fatal on the standard logger then the process will exit with status set to 1.182func Fatalln(args ...interface{}) {183Log.Fatalln(args...)184}185186187