github.com/atc0005/elbow@v0.8.8/internal/logging/constants.go (about)

     1  // Copyright 2020 Adam Chalkley
     2  //
     3  // https://github.com/atc0005/elbow
     4  //
     5  // Licensed under the Apache License, Version 2.0 (the "License");
     6  // you may not use this file except in compliance with the License.
     7  // You may obtain a copy of the License at
     8  //
     9  //     https://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  
    17  package logging
    18  
    19  // Fix linting error
    20  // string `fakeValue` has 3 occurrences, make it a constant (goconst)
    21  const fakeValue = "fakeValue"
    22  
    23  // Log levels
    24  const (
    25  	// https://godoc.org/github.com/sirupsen/logrus#Level
    26  	// https://golang.org/pkg/log/syslog/#Priority
    27  	// https://en.wikipedia.org/wiki/Syslog#Severity_level
    28  
    29  	// LogLevelEmergency represents messages at Emergency level. System is
    30  	// unusable; a panic condition. This level is mapped to logrus.PanicLevel
    31  	// and syslog.LOG_EMERG. logrus calls panic.
    32  	LogLevelEmergency string = "emergency"
    33  
    34  	// LogLevelPanic represents messages at Emergency level. System is
    35  	// unusable; a panic condition. This level is mapped to logrus.PanicLevel
    36  	// and syslog.LOG_EMERG. logrus calls panic.
    37  	LogLevelPanic string = "panic"
    38  
    39  	// LogLevelAlert represents a condition that should be corrected
    40  	// immediately, such as a corrupted system database. This level is mapped
    41  	// to logrus.FatalLevel and syslog.LOG_ALERT. logrus calls os.Exit(1)
    42  	LogLevelAlert string = "alert"
    43  
    44  	// LogLevelFatal is used for errors that should definitely be noted.
    45  	// Commonly used for hooks to send errors to an error tracking service.
    46  	// This level is mapped to logrus.FatalLevel and syslog.LOG_ALERT. logrus
    47  	// calls os.Exit(1)
    48  	LogLevelFatal string = "fatal"
    49  
    50  	// LogLevelCritical is for critical conditions, such as hard device
    51  	// errors. This level is mapepd to logrus.FatalLevel and syslog.LOG_CRIT.
    52  	// logrus calls os.Exit(1)
    53  	LogLevelCritical string = "critical"
    54  
    55  	// LogLevelError is for errors that should definitely be noted. Commonly
    56  	// used for hooks to send errors to an error tracking service. This level
    57  	// maps to logrus.ErrorLevel and syslog.LOG_ERR.
    58  	LogLevelError string = "error"
    59  
    60  	// LogLevelWarn is for non-critical entries that deserve eyes. This level
    61  	// maps to logrus.WarnLevel and syslog.LOG_WARNING.
    62  	LogLevelWarn string = "warn"
    63  
    64  	// LogLevelNotice is for normal but significant conditions; conditions
    65  	// that are not error conditions, but that may require special handling.
    66  	// This level maps to logrus.WarnLevel and syslog.LOG_NOTICE.
    67  	LogLevelNotice string = "notice"
    68  
    69  	// LogLevelInfo is for general application operational entries. This level
    70  	// maps to logrus.InfoLevel and syslog.LOG_INFO.
    71  	LogLevelInfo string = "info"
    72  
    73  	// LogLevelDebug is for debug-level messages and is usually on enabled
    74  	// when debugging. Very verbose logging. This level is mapped to
    75  	// logrus.DebugLevel and syslog.LOG_DEBUG.
    76  	LogLevelDebug string = "debug"
    77  
    78  	// LogLevelTrace is for finer-grained informational events than debug.
    79  	// This level maps to logrus.TraceLevel and syslog.LOG_DEBUG.
    80  	LogLevelTrace string = "trace"
    81  )
    82  
    83  // Log formats used by logrus
    84  const (
    85  
    86  	// LogFormatText represents the logrus text formatter.
    87  	LogFormatText string = "text"
    88  
    89  	// LogFormatJSON represents the logrus JSON formatter.
    90  	LogFormatJSON string = "json"
    91  )
    92  
    93  const (
    94  
    95  	// ConsoleOutputStdout represents os.Stdout
    96  	ConsoleOutputStdout string = "stdout"
    97  
    98  	// ConsoleOutputStderr represents os.Stderr
    99  	ConsoleOutputStderr string = "stderr"
   100  )