golog

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 10 Imported by: 3

README

MrAndreID / Go Log

Go Reference

The MrAndreID/GoLog package is a collection of functions in the go language for Log.


Table of Contents


Install

To use The MrAndreID/GoLog package, you must follow the steps below:

go get -u github.com/MrAndreID/golog

Usage

Init

To use Init Func., The MrAndreID/GoLog package will add/modify .gitignore file and add logs/ and the last one will create a logs folder. Inside the logs folder will contain the log files based on the log file creation date. The contents of the first parameter is used to limit the number of log files created other than the day's log files. The second parameter (logLevel) are all, error, success, warning, & info. The second parameter (logLevel) is used for the log level to be stored in the log file. The third parameter (timezone) is used to set the time zone used. The fourth parameter (style) is used to set the style. Style is to add color.

golog.Init(30, "all", "Asia/Jakarta", false)
Error
golog.Error("Andrea Adam")

Output:

2021-02-15 18:45:18 [ ERROR ] Andrea Adam
Success
golog.Success("Andrea Adam")

Output:

2021-02-15 18:45:18 [ SUCCESS ] Andrea Adam
Warning
golog.Warning("Andrea Adam")

Output:

2021-02-15 18:45:18 [ WARNING ] Andrea Adam
Info
golog.Info("Andrea Adam")

Output:

2021-02-15 18:45:18 [ INFO ] Andrea Adam

Full Example

Full Example can be found on the Go Playground website.

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Andrea Adam - MrAndreID

License

MIT licensed. See the LICENSE file for details.

Official Documentation for Go Language

Documentation for Go Language can be found on the Go Language website.

More

Documentation can be found on https://go.dev/.

Documentation

Index

Constants

View Source
const (
	Reset = "\033[0m"

	PrimaryRed    = "\033[1;41m"
	PrimaryGreen  = "\033[1;42m"
	PrimaryYellow = "\033[1;43m"
	PrimaryCyan   = "\033[1;46m"

	SecondaryRed    = "\033[0;91m"
	SecondaryGreen  = "\033[0;92m"
	SecondaryYellow = "\033[0;93m"
	SecondaryCyan   = "\033[0;96m"
)

Variables

View Source
var (
	Limit                int
	LogLevel, LastUpdate string
	TimeZone             time.Location
	Style                bool
)

Functions

func Error

func Error(message string)

func ExecutionLimit added in v1.1.0

func ExecutionLimit()

func Info

func Info(message string)

func Init added in v1.1.0

func Init(limit int, logLevel, timeZone string, style bool) error

func Success

func Success(message string)

func Warning

func Warning(message string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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