golog

package module
v0.0.0-...-6bbeddb Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

README

Go-Log

Go Report Card

Go-Log is a utility log package built to customize the Go's normal log package. Prominent features are

  • Tag the logs into debug and error variant.
  • Add/Remove Timestamp to logs
  • Get the calling function details in logs
  • Synchronized with mutex locks to handle multiple logging
Install
go get github.com/MindorksOpenSource/Go-Log
Import
import (
	"github.com/MindorksOpenSource/Go-Log"
)

Examples

1. GoLog Debug
func main() {
	golog.D("A basic primitive debug log.")
}

This golog prints the message without any extra information like:

$ A basic primitive debug log.
2. GoLog Error
func main() {
	golog.E("This a basic primitive error log.")
}

This golog prints the message while tagging it as an ERROR like:

$ [ERROR] This a basic primitive error log.
Configuration (Additional Information)
// Adds time to the log
golog.ConfigureTimer()
// Adds the calling function path to log
golog.ConfigureCallingFunction()
3. GoLog Debug/Error with Time
func main() {
	golog.ConfigureTimer()
	golog.D("A debug log with time")
}

This golog prints the message with its timestamp like:

$ 2018/10/29 15:52:24  A debug log with time
4. GoLog Debug/Error with CallingFunction
func main() {
	golog.ConfigureCallingFunction()
	golog.D("A debug log with calling function")
}

This golog prints the message with its timestamp like:

$ [main.main] A debug log with calling function

You can use both the configurations together also. Go gophers!

Contributor

Yashish Dua

Show some ❤

GitHub stars GitHub forks GitHub watchers GitHub followers
Twitter Follow

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IsCallingFunctionEnabled bool

IsCallingFunctionEnabled : Exported to be get to know the configuration

View Source
var IsTimeEnabled bool

IsTimeEnabled : Exported to be get to know the configuration

Functions

func ConfigureCallingFunction

func ConfigureCallingFunction()

ConfigureCallingFunction : Exported to be able to call it

func ConfigureTimer

func ConfigureTimer()

ConfigureTimer : Exported to be able to call it

func D

func D(message string)

D : Default Logger

func E

func E(message string)

E : Error Logger

Types

This section is empty.

Jump to

Keyboard shortcuts

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