gosimplelogger

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: ISC Imports: 3 Imported by: 2

README

gosimplelogger

GoDoc

A very simple logger for Go, for tiny personal projects where I don't feel like using one of the Big Name logging frameworks out there.

Usage

import log "github.com/Crosse/gosimplelogger

Documentation

Overview

Package gosimplelogger implements a simple logging package that includes the notion of logging levels.

Index

Constants

View Source
const (
	// Log Levels.
	LogPanic = iota
	LogFatal
	LogError
	LogInfo
	LogVerbose
	LogDebug
)

Variables

View Source
var (
	// LogLevel is the highest level that will be logged.  The
	// default, LogInfo, means that Info, Error, Fatal, and Panic
	// log messages will be emitted, but Verbose and Debug messages
	// will not.
	LogLevel = LogInfo
)

Functions

func Debug

func Debug(v ...interface{})

Debug prints to the verbose logger, but only if LogLevel >= LogDebug. Arguments are handled in the manner of fmt.Println.

func Debugf

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

Debugf prints to the verbose logger, but only if LogLevel >= LogDebug. Arguments are handled in the manner of fmt.Printf.

func Error

func Error(v ...interface{})

Error prints to the error logger (which logs to standard error by default), but only if LogLevel >= LogError. Arguments are handled in the manner of fmt.Println.

func Errorf

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

Errorf prints to the error logger (which logs to standard error by default), but only if LogLevel >= LogError. Arguments are handled in the manner of fmt.Printf.

func Fatal

func Fatal(v ...interface{})

Fatal prints to the error logger (which logs to standard error by default), but only if LogLevel >= LogFatal. Arguments are handled in the manner of fmt.Println. Fatal is equivalent to Error() followed by a call to os.Exit(1).

func Fatalf

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

Fatalf prints to the error logger (which logs to standard error by default), but only if LogLevel >= LogFatal. Arguments are handled in the manner of fmt.Printf. Fatal is equivalent to Error() followed by a call to os.Exit(1).

func Info

func Info(v ...interface{})

Info prints to the info logger, but only if LogLevel >= LogInfo. Arguments are handled in the manner of fmt.Println.

func Infof

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

Infof prints to the info logger, but only if LogLevel >= LogInfo. Arguments are handled in the manner of fmt.Printf.

func Panic

func Panic(v ...interface{})

Panic prints to the error logger (which logs to standard error by default), but only if LogLevel >= LogPanic. Arguments are handled in the manner of fmt.Println. Panic is equivalent to calling Error() followed by a call to panic().

func Panicf

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

Panicf prints to the error logger (which logs to standard error by default), but only if LogLevel >= LogPanic. Arguments are handled in the manner of fmt.Printf. Panicf is equivalent to calling Errorf() followed by a call to panic().

func Printf

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

Printf prints to the info logger, but only if LogLevel >= LogInfo. Arguments are handled in the manner of fmt.Printf. Printf simply calls Infof() and is included for compatibility with Go's log.Printf.

func Println

func Println(v ...interface{})

Println prints to the info logger, but only if LogLevel >= LogInfo. Arguments are handled in the manner of fmt.Println. Println simply calls Info() and is included for compatibility with Go's log.Println.

func Verbose

func Verbose(v ...interface{})

Verbose prints to the verbose logger, but only if LogLevel >= LogVerbose. Arguments are handled in the manner of fmt.Println.

func Verbosef

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

Verbosef prints to the verbose logger, but only if LogLevel >= LogVerbose. Arguments are handled in the manner of fmt.Printf.

Types

This section is empty.

Jump to

Keyboard shortcuts

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