log

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: GPL-3.0 Imports: 5 Imported by: 5

Documentation

Overview

Copyright © 2022 Antonin Portelli <antonin.portelli@me.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2022 Antonin Portelli <antonin.portelli@me.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2022 Antonin Portelli <antonin.portelli@me.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var Dbg = Logger{
	Level:     2,
	Color:     color.New(color.FgYellow),
	StdLogger: log.New(os.Stdout, "DEBUG   : ", 0),
}
View Source
var Emph = Logger{
	Level:     0,
	Color:     color.New(color.FgGreen, color.Bold),
	StdLogger: log.New(os.Stdout, "", 0),
}
View Source
var Err = Logger{
	Level:     0,
	Color:     color.New(color.FgRed, color.Bold),
	StdLogger: log.New(os.Stderr, "ERROR   : ", 0),
}
View Source
var Inf = Logger{
	Level:     1,
	Color:     color.New(color.FgHiBlack),
	StdLogger: log.New(os.Stdout, "INFO    : ", 0),
}
View Source
var Level int = 0
View Source
var Msg = Logger{
	Level:     0,
	Color:     color.New(),
	StdLogger: log.New(os.Stdout, "", 0),
}
View Source
var Warn = Logger{
	Level:     0,
	Color:     color.New(color.FgHiMagenta, color.Bold),
	StdLogger: log.New(os.Stderr, "WARNING : ", 0),
}

Functions

func AtMostLevel

func AtMostLevel(maxLevel int) int

func ErrorCheck

func ErrorCheck(err error, message string)

func SizeString

func SizeString(b ByteSize) string

Types

type ByteSize

type ByteSize float64

Pretty print sizes, from Effective Go (https://go.dev/doc/effective_go#constants)

const (
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	EB
	ZB
	YB
)

type Logger

type Logger struct {
	Level     int
	Color     *color.Color
	StdLogger *log.Logger
}

func (Logger) Fatalf

func (l Logger) Fatalf(format string, a ...any)

func (Logger) Fatalln

func (l Logger) Fatalln(a ...any)

func (Logger) Printf

func (l Logger) Printf(format string, a ...any)

func (Logger) Println

func (l Logger) Println(a ...any)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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