gorillalog

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(logStrings ...interface{})

Debug logs a string as DEBUG We write to disk if debug is true

Example (Off)

ExampleDebug_off tests the output of a log sent to DEBUG while config.Debug is false

// Set up what we expect
logString := "Debug String!"

// Run the function without debug
debug = false
Debug(logString)
Output:

Example (On)

ExampleDebug_on tests the output of a log sent to DEBUG while config.Debug is true

// Set up what we expect
logString := "Debug String!"

// Run the function with debug
debug = true
Debug(logString)
Output:

Debug String!

func Error

func Error(logStrings ...interface{})

Error logs a string a ERROR We print to stdout, write to disk, and then panic

Example

ExampleError tests the output of a log sent to ERROR

// Set up what we expect
logString := "Error String!"

// Prepare to recover from a panic
defer func() {
	recover()
}()

// Run the function
Error(logString)
Output:

func Info

func Info(logStrings ...interface{})

Info logs a string as INFO We only print to stdout if verbose is true

Example (Verbose_off)

ExampleInfo_verbose_off tests the output of a log sent to INFO while config.Verbose is false

// Set up what we expect
logString := "Info String!"

// Run the function without verbose
verbose = false

Info(logString)
Output:

Example (Verbose_on)

ExampleInfoVerboseOn tests the output of a log sent to INFO while config.Verbose is true

// Set up what we expect
logString := "Info String!"

// Run the function with verbose
verbose = true

Info(logString)
Output:

Info String!

func NewLog

func NewLog(cfg config.Configuration)

NewLog creates a file and points a new logging instance at it

func Warn

func Warn(logStrings ...interface{})

Warn logs a string as WARN We print to stdout and write to disk

Example

ExampleWarn tests the output of a log sent to WARN

// Set up what we expect
logString := "Warn String!"

// Run the function
Warn(logString)
Output:

Warn String!

Types

This section is empty.

Jump to

Keyboard shortcuts

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