Documentation ¶
Index ¶
- Constants
- func Debug(s string, v ...interface{})
- func Error(s string, v ...interface{})
- func Fatal(err error, s string, v ...interface{})
- func FatalOnError(err error, output ...string)
- func FatalWithoutPanic(s string, v ...interface{})
- func GenerateLogFileName(program, logdir string) string
- func GetErrorCode() int
- func GetHeader(program string) string
- func GetLogFilePath() string
- func GetLogFileVerbosity() int
- func GetLogPrefix(level string) string
- func GetVerbosity() int
- func Info(s string, v ...interface{})
- func InitializeLogging(program string, logdir string)
- func SetErrorCode(code int)
- func SetExitFunc(pExitFunc func())
- func SetLogFileNameFunc(fileNameFunc func(string, string) string)
- func SetLogFileVerbosity(verbosity int)
- func SetLogPrefixFunc(logPrefixFunc func(string) string)
- func SetLogger(log *GpLogger)
- func SetVerbosity(verbosity int)
- func Verbose(s string, v ...interface{})
- func Warn(s string, v ...interface{})
- type ExitFunc
- type GpLogger
- type LogFileNameFunc
- type LogPrefixFunc
Constants ¶
const ( /* * The following constants representing the current logging level, and are * cumulative (that is, setting the log level to Debug will print all Error-, * Info-, and Verbose-level messages in addition to Debug-level messages). * * Log levels for terminal output and logfile output are separate, and can be * set independently. By default, a new logger will have a verbosity of INFO * for terminal output and DEBUG for logfile output. */ LOGERROR = iota LOGINFO LOGVERBOSE LOGDEBUG )
Variables ¶
This section is empty.
Functions ¶
func FatalOnError ¶
func FatalWithoutPanic ¶
func FatalWithoutPanic(s string, v ...interface{})
func GenerateLogFileName ¶
func GetErrorCode ¶
func GetErrorCode() int
func GetLogFilePath ¶
func GetLogFilePath() string
func GetLogFileVerbosity ¶
func GetLogFileVerbosity() int
func GetLogPrefix ¶
func GetVerbosity ¶
func GetVerbosity() int
func InitializeLogging ¶
* Multiple calls to InitializeLogging can be made if desired; the first call * will initialize the logger as a singleton and subsequent calls will return * the same Logger instance.
func SetErrorCode ¶
func SetErrorCode(code int)
func SetExitFunc ¶
func SetExitFunc(pExitFunc func())
func SetLogFileNameFunc ¶
func SetLogFileVerbosity ¶
func SetLogFileVerbosity(verbosity int)
func SetLogPrefixFunc ¶
func SetVerbosity ¶
func SetVerbosity(verbosity int)
Types ¶
type LogFileNameFunc ¶
type LogPrefixFunc ¶
* Leveled logging output functions using the above log levels are implemented * below. Info(), Verbose(), and Debug() print messages when the log level is * set at or above the log level matching their names. Warn(), Error(), and * Fatal() always print their messages regardless of the current log level. * * The intended usage of these functions is as follows: * - Info: Messages that should always be written unless the user explicitly * suppresses output, e.g. notifying the user that a step has completed. * - Verbose: More detailed messages that are mostly useful to the user, e.g. * printing information about a function's substeps for progress tracking. * - Debug: More detailed messages that are mostly useful to developers, e.g. * noting that a function has been called with certain arguments. * - Warn: Messages indicating unusual but not incorrect behavior that a user * may want to know, e.g. that certain steps are skipped when using * certain flags. These messages are shown even if output is suppressed. * - Error: Messages indicating that an error has occurred, but that the program * can continue, e.g. one function call in a group failed but others succeeded. * - Fatal: Messages indicating that the program cannot proceed, e.g. the database * cannot be reached. This function will exit the program after printing * the error message. * - FatalWithoutPanic: Same as Fatal, but will not trigger panic. Just exit(1).