log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package log is a logger used by Abot core and plugins. It standardizes logging formats consistent with Abot's needs, allowing for a debug mode, and enabling plugins to specify their own name so each plugin's logs are easy to isolate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

Debug logs a statement with the debug prefix if SetDebug(true) has been called and ends with a new line.

func DebugPrefix

func DebugPrefix(s string)

DebugPrefix overrides the default "DEBUG: " prefix for debug logs.

func Debugf

func Debugf(format string, v ...interface{})

Debugf logs a statement with the debug prefix if SetDebug(true) has been called, allowing for custom formatting.

func Fatal

func Fatal(v ...interface{})

Fatal logs a statement and kills the running process.

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf logs a statement and kills the running process, allowing for custom formatting.

func Info

func Info(v ...interface{})

Info logs a statement and ends with a new line.

func Infof

func Infof(format string, v ...interface{})

Infof logs a statement, allowing for custom formatting.

func SetDebug

func SetDebug(b bool)

SetDebug shows or hides debug logs. Default: false (debug off)

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is defined for plugins to use in place of the stdlib log. It sets a prefix of the plugin name with each log and follows the convention of.

func New

func New(pluginName string) *Logger

New returns a Logger which supports a custom prefix representing a plugin's name.

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

Debug logs a statement with the debug prefix if SetDebug(true) has been called and ends with a new line.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf logs a statement with the debug prefix if SetDebug(true) has been called, allowing for custom formatting.

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

Error is not used, but it's included to satisfy the Echo router's Logger interface. The rationale on why Warn and Error have been excluded can be found here: http://dave.cheney.net/2015/11/05/lets-talk-about-logging

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf is not used, but it's included to satisfy the Echo router's Logger interface. The rationale on why Warn and Error have been excluded can be found here: http://dave.cheney.net/2015/11/05/lets-talk-about-logging

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

Fatal logs a statement and kills the running process.

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

Fatalf logs a statement and kills the running process, allowing for custom formatting.

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

Info logs a statement and ends with a new line.

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

Infof logs a statement, allowing for custom formatting.

func (*Logger) SetDebug

func (l *Logger) SetDebug(b bool)

SetDebug shows or hides debug logs. Default: false (debug off)

func (*Logger) SetFlags

func (l *Logger) SetFlags(flag int)

SetFlags enables customizing flags just like the standard library's log.SetFlags.

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

Warn is not used, but it's included to satisfy the Echo router's Logger interface. The rationale on why Warn and Error have been excluded can be found here: http://dave.cheney.net/2015/11/05/lets-talk-about-logging

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

Warnf is not used, but it's included to satisfy the Echo router's Logger interface. The rationale on why Warn and Error have been excluded can be found here: http://dave.cheney.net/2015/11/05/lets-talk-about-logging

Jump to

Keyboard shortcuts

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