Documentation ¶
Index ¶
- Constants
- Variables
- func Critical(message string, fields ...Fields)
- func Debug(message string, fields ...Fields)
- func Error(message string, fields ...Fields)
- func GetLevel() string
- func Info(message string, fields ...Fields)
- func InitSeelog()
- func SetConfigLogFile(logFile string)
- func SetConfigMaxFileSizeMB(maxSizeInMB float64)
- func SetConfigOutputFormat(outputFormat string)
- func SetDriverLogLevel(driverLogLevel string)
- func SetInstanceLogLevel(instanceLogLevel string)
- func SetLogToStdout(duplicate bool)
- func SetRolloverType(rolloverType string)
- func SetTimestampFormat(format string)
- func StartRuntimeStatsLogger(runtimeStatsLogFile string) (flush func())
- func Trace(message string, fields ...Fields)
- func Warn(message string, fields ...Fields)
- type Fields
- type StructuredLogger
Constants ¶
const ( LOGLEVEL_ENV_VAR = "ECS_LOGLEVEL" LOGLEVEL_ON_INSTANCE_ENV_VAR = "ECS_LOGLEVEL_ON_INSTANCE" LOGFILE_ENV_VAR = "ECS_LOGFILE" LOG_DRIVER_ENV_VAR = "ECS_LOG_DRIVER" LOG_ROLLOVER_TYPE_ENV_VAR = "ECS_LOG_ROLLOVER_TYPE" LOG_OUTPUT_FORMAT_ENV_VAR = "ECS_LOG_OUTPUT_FORMAT" LOG_MAX_FILE_SIZE_ENV_VAR = "ECS_LOG_MAX_FILE_SIZE_MB" LOG_MAX_ROLL_COUNT_ENV_VAR = "ECS_LOG_MAX_ROLL_COUNT" DEFAULT_LOGLEVEL = "info" DEFAULT_LOGLEVEL_WHEN_DRIVER_SET = "off" DEFAULT_ROLLOVER_TYPE = "date" DEFAULT_OUTPUT_FORMAT = logFmt DEFAULT_TIMESTAMP_FORMAT = time.RFC3339 DEFAULT_MAX_FILE_SIZE float64 = 10 DEFAULT_MAX_ROLL_COUNT int = 24 DEFAULT_LOGTO_STDOUT = true )
Variables ¶
var Config *logConfig
Functions ¶
func InitSeelog ¶
func InitSeelog()
InitSeelog registers custom logging formats, updates the internal Config struct and reloads the global logger. This should only be called once, as external callers should use the Config struct over environment variables directly.
func SetConfigLogFile ¶
func SetConfigLogFile(logFile string)
SetConfigLogFile sets the default output file of the logger.
func SetConfigMaxFileSizeMB ¶
func SetConfigMaxFileSizeMB(maxSizeInMB float64)
SetConfigMaxFileSizeMB sets the max file size of a log file in Megabytes before the logger rotates to a new file.
func SetConfigOutputFormat ¶
func SetConfigOutputFormat(outputFormat string)
SetConfigOutputFormat sets the output format of the logger. e.g. json, xml, etc.
func SetDriverLogLevel ¶
func SetDriverLogLevel(driverLogLevel string)
SetDriverLogLevel explicitly sets the log level for a custom driver.
func SetInstanceLogLevel ¶
func SetInstanceLogLevel(instanceLogLevel string)
SetInstanceLogLevel explicitly sets the log level for instance logs.
func SetLogToStdout ¶
func SetLogToStdout(duplicate bool)
SetLogToStdout decides whether the logger should write to stdout using the <console/> tag in addition to logfiles that are set up.
func SetRolloverType ¶
func SetRolloverType(rolloverType string)
SetRolloverType sets the logging rollover constraint. This should be either size or date. Logger will roll to a new log file based on this constraint.
func SetTimestampFormat ¶
func SetTimestampFormat(format string)
SetTimestampFormat sets the time formatting for custom seelog formatters. It will expect a valid time format such as time.RFC3339 or "2006-01-02T15:04:05.000".
func StartRuntimeStatsLogger ¶
func StartRuntimeStatsLogger(runtimeStatsLogFile string) (flush func())