log

package
v0.82.1 Latest Latest
Warning

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

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

Documentation

Overview

Package log contains a simple logging mechanism for qaz

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorMap

func ColorMap(s string) string

ColorMap - Used to map a particular color to a cf status phrase - returns lowercase strings in color.

func ColorString

func ColorString(s string, col Color) string

ColorString - Returns colored string

func Debug

func Debug(m string, args ...interface{})

Debug - calls default logger Debug method

func Error

func Error(m string, args ...interface{})

Error - calls default logger Error method

func Info

func Info(m string, args ...interface{})

Info - calls default logger Info method

func SetDefault

func SetDefault(logger Logger)

SetDefault - sets default logger

func Warn

func Warn(m string, args ...interface{})

Warn - calls default logger Warn method

Types

type Color

type Color uint8

Color type used in ColorString function

const (
	// GREEN - log color green
	GREEN Color = 0

	// CYAN - log color cyan
	CYAN Color = 1

	// RED - log color red
	RED Color = 2

	// MAGENTA - log color megenta
	MAGENTA Color = 3

	// YELLOW - log color yellow
	YELLOW Color = 4
)

type DefaultLogger

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

DefaultLogger - default logger type

func (*DefaultLogger) Colors

func (l *DefaultLogger) Colors() bool

Colors - returns bool indicating whether colors should be applied to logs

func (*DefaultLogger) Debug

func (l *DefaultLogger) Debug(msg string, args ...interface{})

Debug - Prints debug level log statements

func (*DefaultLogger) Error

func (l *DefaultLogger) Error(msg string, args ...interface{})

Error - Prints error level log statements

func (*DefaultLogger) Info

func (l *DefaultLogger) Info(msg string, args ...interface{})

Info - Prints info level log statments

func (*DefaultLogger) Warn

func (l *DefaultLogger) Warn(msg string, args ...interface{})

Warn - Prints warn level log statments

type Logger

type Logger interface {
	Info(string, ...interface{})
	Warn(string, ...interface{})
	Error(string, ...interface{})
	Debug(string, ...interface{})
	Colors() bool
}

Logger log interface

func Default

func Default() Logger

Default - returns the default logger

func NewDefaultLogger

func NewDefaultLogger(debug, colors bool) Logger

NewDefaultLogger - creates a Logger Object

Jump to

Keyboard shortcuts

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