Categorygithub.com/jgolang/log
modulepackage
1.3.7
Repository: https://github.com/jgolang/log.git
Documentation: pkg.go.dev

# README

Log v1

Simple, fast, structured and level registration in Go.

Overview

This package offers several functions that allow you to trace controlled log errors in the files and functions where they occur, as well as useful programmer log comments in your code. This package will help you identify and segment the different types of errors log or unique circumstances during the execution of your program using criteria according to the level of impact on the business rules of its development. The package prints the useful information for the programmer in a human readable format.

Installation

go get -u https://github.com/jgolang/log

Quick Start

package main

import "github.com/jgolang/log"

func main(){
    log.Println("My info....")
}

Terminal output:

2020/07/05 13:32:03     INFO    /dir/file.go:10 (function) My info...

Mode

You can configure the package depending on your needs to display certain types of log by defining an environment variable on the system that runs your program.

[user@ /home]# export MODE="DEV"

Allowed modes

ModeDescription
PRODOnly prints error log
DEVPrint all

Note: Error logs are printed regardless of this setting.


Released under the GPL-3.0.

# Packages

No description provided by the author
No description provided by the author

# Functions

Debug logs a debug-level message using the global logger.
DebugC logs a debug-level message with context using the global logger.
Error logs an error-level message using the global logger.
ErrorC logs an error-level message with context using the global logger.
Fatal logs a fatal-level message using the global logger and then calls os.Exit(1).
FatalC logs a fatal-level message with context using the global logger and then calls os.Exit(1).
No description provided by the author
No description provided by the author
Level return current log level.
No description provided by the author
No description provided by the author
Panic logs a panic-level message using the global logger and then panics.
PanicC logs a panic-level message with context using the global logger and then panics.
No description provided by the author
No description provided by the author
SetCalldepth configure the number of stack frames to ascend, with 0 identifying the caller of Caller for default loggin.
SetLevel sets the logging level for the Logger instance.
StackTrace allows you to view the exact place where the error or incident originated within the code.
Warn logs a warning-level message using the global logger.
WarnC logs a warning-level message with context using the global logger.