logger

package
v0.0.0-...-c641a3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2019 License: Apache-2.0 Imports: 7 Imported by: 31

Documentation

Index

Constants

View Source
const (
	// ==============================
	// ======= Log field keys =======
	// These keys are to be used for structured logging, and will
	// be visible to the Elastic Search repository for query and the like.
	LogkeyCaller           = "caller_info"
	LogkeyTrainingID       = "training_id"
	LogkeyGpuType          = "gpu_type"
	LogkeyGpuUsage         = "gpu_usage"
	LogkeyFramework        = "framework_name"
	LogkeyFrameworkVersion = "framework_version"
	LogkeyErrorCode        = "error_code"
	LogkeyErrorType        = "error_type"
	LogkeyModelID          = "model_id"
	LogkeyModelName        = "model_name"
	LogkeyDBName           = "db_name"
	LogkeyUserID           = "user_id"
	LogkeyModule           = "module"
	LogkeyIsMetrics        = "is_metrics"
	LogkeyIsFollow         = "is_follow"
	LogkeyIsSummary        = "is_summary"
	LogkeyObjectstorePath  = "os_path"
	LogkeyTrainingDataURI  = "training_data_uri"
	LogkeyModelDataURI     = "model_data_uri"
	LogkeyModelFilename    = "model_filename"

	LogkeyDeployerService      = "deployer-service"
	LogkeyLcmService           = "lifecycle-manager-service"
	LogkeyRestAPIService       = "rest-api"
	LogkeyStorageService       = "storage-service"
	LogkeyTrainerService       = "trainer-service"
	LogkeyVolumeManagerService = "volume-manager-service"

	LogkeyJobMonitor = "jobmonitor"

	// DLAAS_LOG_GETTRAININGLOGSTREAM=true
	LogCategoryGetTrainingLogStream             = "log_GetTrainingLogStream"
	LogCategoryGetTrainingLogStreamDefaultValue = false

	// DLAAS_LOG_GETTRAININGLOGSTREAMFROMOBJSTORE=true
	LogCategoryGetTrainingLogStreamFromObjStore             = "log_getTrainingLogStreamFromObjStore"
	LogCategoryGetTrainingLogStreamFromObjStoreDefaultValue = false

	// DLAAS_LOG_REPOSITORY=true
	LogCategoryRepository             = "log_repository"
	LogCategoryRepositoryDefaultValue = false

	// DLAAS_LOG_SERVELOGHANDLER=true
	LogCategoryServeLogHandler             = "log_serveLogHandler"
	LogCategoryServeLogHandlerDefaultValue = false
)

Constants for logging

Variables

This section is empty.

Functions

func Config

func Config()

Config initializes the logging by setting the env var LOGLEVEL=<level>. Valid level values are: panic, fatal, error, warn, info, debug

func FileInfoFindGood

func FileInfoFindGood() string

FileInfoFindGood looks at the stack, and tries to find the first entry that is not infrastructure related. i.e. that is essentially application code.

func LogServiceBasic

func LogServiceBasic(serviceName string) *log.Entry

LogServiceBasic Construct new basic logger for service.

func LogServiceBasicWithFields

func LogServiceBasicWithFields(serviceName string, fields log.Fields) *log.Entry

LogServiceBasicWithFields Construct new basic logger for service, with key/value pairs.

func NewDlaaSLogData

func NewDlaaSLogData(serviceName string) log.Fields

NewDlaaSLogData construct log data object.

Types

type LocLoggingEntry

type LocLoggingEntry struct {
	Logger *log.Entry

	// If true, enable functions at the level of debug, info, and print.
	// Warn, Error, Fatal, and Panic are always enabled.
	Enabled bool
}

LocLoggingEntry wraps another logger, and add code location information about where the the log entry occurs. Because logging can be expensive, especially logging that needs to figure out it's location, this class also has a way to disable the logging for debug/informational entries.

func LocLogger

func LocLogger(logr *log.Entry) *LocLoggingEntry

LocLogger simply creates a LocLoggingEntry that wraps another logger.

func LocLoggerCategorized

func LocLoggerCategorized(logr *log.Entry, isEnabledKey string) *LocLoggingEntry

LocLoggerCategorized creates a LocLoggingEntry that wraps another logger, and accepts a string that is used with viper to say whether the informational/debug logging is enabled for this logger.

func (*LocLoggingEntry) Debug

func (entry *LocLoggingEntry) Debug(args ...interface{})

func (*LocLoggingEntry) Debugf

func (entry *LocLoggingEntry) Debugf(format string, args ...interface{})

func (*LocLoggingEntry) Debugln

func (entry *LocLoggingEntry) Debugln(args ...interface{})

func (*LocLoggingEntry) Error

func (entry *LocLoggingEntry) Error(args ...interface{})

func (*LocLoggingEntry) Errorf

func (entry *LocLoggingEntry) Errorf(format string, args ...interface{})

func (*LocLoggingEntry) Errorln

func (entry *LocLoggingEntry) Errorln(args ...interface{})

func (*LocLoggingEntry) Fatal

func (entry *LocLoggingEntry) Fatal(args ...interface{})

func (*LocLoggingEntry) Fatalf

func (entry *LocLoggingEntry) Fatalf(format string, args ...interface{})

func (*LocLoggingEntry) Fatalln

func (entry *LocLoggingEntry) Fatalln(args ...interface{})

func (*LocLoggingEntry) Info

func (entry *LocLoggingEntry) Info(args ...interface{})

func (*LocLoggingEntry) Infof

func (entry *LocLoggingEntry) Infof(format string, args ...interface{})

func (*LocLoggingEntry) Infoln

func (entry *LocLoggingEntry) Infoln(args ...interface{})

func (*LocLoggingEntry) MakeNew

func (entry *LocLoggingEntry) MakeNew(logr *log.Entry) *LocLoggingEntry

MakeNew makes a new LocLoggingEntry from an existing LocLoggingEntry, but using a new inner logger.

func (*LocLoggingEntry) Panic

func (entry *LocLoggingEntry) Panic(args ...interface{})

func (*LocLoggingEntry) Panicf

func (entry *LocLoggingEntry) Panicf(format string, args ...interface{})

func (*LocLoggingEntry) Panicln

func (entry *LocLoggingEntry) Panicln(args ...interface{})

func (*LocLoggingEntry) Print

func (entry *LocLoggingEntry) Print(args ...interface{})

func (*LocLoggingEntry) Printf

func (entry *LocLoggingEntry) Printf(format string, args ...interface{})

func (*LocLoggingEntry) Println

func (entry *LocLoggingEntry) Println(args ...interface{})

func (*LocLoggingEntry) Warn

func (entry *LocLoggingEntry) Warn(args ...interface{})

func (*LocLoggingEntry) Warnf

func (entry *LocLoggingEntry) Warnf(format string, args ...interface{})

func (*LocLoggingEntry) Warning

func (entry *LocLoggingEntry) Warning(args ...interface{})

func (*LocLoggingEntry) Warningf

func (entry *LocLoggingEntry) Warningf(format string, args ...interface{})

func (*LocLoggingEntry) Warningln

func (entry *LocLoggingEntry) Warningln(args ...interface{})

func (*LocLoggingEntry) Warnln

func (entry *LocLoggingEntry) Warnln(args ...interface{})

func (*LocLoggingEntry) WithError

func (entry *LocLoggingEntry) WithError(err error) *LocLoggingEntry

Add an error as single field (using the key defined in ErrorKey) to the Entry.

func (*LocLoggingEntry) WithField

func (entry *LocLoggingEntry) WithField(key string, value interface{}) *LocLoggingEntry

Add a single field to the Entry.

func (*LocLoggingEntry) WithFields

func (entry *LocLoggingEntry) WithFields(fields log.Fields) *LocLoggingEntry

Add a map of fields to the Entry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL