Documentation
¶
Overview ¶
Package gologit implements a very simple wrapper around the Go "log" package, providing support for a toggle-able debug flag and a couple of functions that log or not based on that flag.
Index ¶
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func Set(debug bool)
- func State() bool
- func Toggle()
- func ToggleOnSignal(sig os.Signal)
- type DebugLogger
- func (l *DebugLogger) Debug(v ...interface{})
- func (l *DebugLogger) Debugf(format string, v ...interface{})
- func (l *DebugLogger) Debugln(v ...interface{})
- func (l *DebugLogger) Set(debug bool)
- func (l *DebugLogger) State() bool
- func (l *DebugLogger) Toggle()
- func (l *DebugLogger) ToggleOnSignal(sig os.Signal)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Logger = New(false)
Functions ¶
func Debugf ¶
func Debugf(format string, v ...interface{})
Logs to the default Logger. See Logger.Debugf
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Logs to the default Logger. See Logger.Fatalf
func Panicf ¶
func Panicf(format string, v ...interface{})
Logs to the default Logger. See Logger.Panicf
func Printf ¶
func Printf(format string, v ...interface{})
Logs to the default Logger. See Logger.Printf
func ToggleOnSignal ¶
Types ¶
type DebugLogger ¶
A DebugLogger represents a logging object, that embeds log.Logger, and provides support for a toggle-able debug flag.
func New ¶
func New(debug bool) *DebugLogger
New creates a new DebugLogger. The debug argument specifies whether debug should be set or not.
Example ¶
package main
import (
"github.com/cactus/gologit"
)
func main() {
logger := gologit.New(true)
logger.Debug("It works!")
}
func (*DebugLogger) Debug ¶
func (l *DebugLogger) Debug(v ...interface{})
Debug calls log.Print if debug is true. If debug is false, does nothing.
func (*DebugLogger) Debugf ¶
func (l *DebugLogger) Debugf(format string, v ...interface{})
Debugf calls log.Printf if debug is true. If debug is false, does nothing.
func (*DebugLogger) Debugln ¶
func (l *DebugLogger) Debugln(v ...interface{})
Debugln calls log.Println if debug is true. If debug is false, does nothing.
func (*DebugLogger) State ¶
func (l *DebugLogger) State() bool
func (*DebugLogger) Toggle ¶
func (l *DebugLogger) Toggle()
Toggles the debug state. If debug is true, sets it to false. If debug is false, sets it to true.
func (*DebugLogger) ToggleOnSignal ¶
func (l *DebugLogger) ToggleOnSignal(sig os.Signal)