Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mindorksopensource/go-log
A Go logger package which provides utility on top of Go's normal Log package.
https://github.com/mindorksopensource/go-log
go golang logger opensource package utility
Last synced: 3 months ago
JSON representation
A Go logger package which provides utility on top of Go's normal Log package.
- Host: GitHub
- URL: https://github.com/mindorksopensource/go-log
- Owner: MindorksOpenSource
- License: bsd-3-clause
- Created: 2018-10-26T20:57:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T19:39:23.000Z (about 6 years ago)
- Last Synced: 2024-05-02T01:10:06.303Z (9 months ago)
- Topics: go, golang, logger, opensource, package, utility
- Language: Go
- Homepage:
- Size: 2.11 MB
- Stars: 19
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go-Log
[![Go Report Card](https://goreportcard.com/badge/github.com/MindorksOpenSource/Go-Log)](https://goreportcard.com/report/github.com/MindorksOpenSource/Go-Log)
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
```bash
go get github.com/MindorksOpenSource/Go-Log
```### Import
```go
import (
"github.com/MindorksOpenSource/Go-Log"
)
```
## Examples### 1. GoLog Debug
```go
func main() {
golog.D("A basic primitive debug log.")
}
```This golog prints the message without any extra information like:
```bash
$ A basic primitive debug log.
```### 2. GoLog Error
```go
func main() {
golog.E("This a basic primitive error log.")
}
```This golog prints the message while tagging it as an ERROR like:
```bash
$ [ERROR] This a basic primitive error log.
```
### Configuration (Additional Information)```go
// Adds time to the log
golog.ConfigureTimer()
// Adds the calling function path to log
golog.ConfigureCallingFunction()
```### 3. GoLog Debug/Error with Time
```go
func main() {
golog.ConfigureTimer()
golog.D("A debug log with time")
}
```This golog prints the message with its timestamp like:
```bash
$ 2018/10/29 15:52:24 A debug log with time
```### 4. GoLog Debug/Error with CallingFunction
```go
func main() {
golog.ConfigureCallingFunction()
golog.D("A debug log with calling function")
}
```This golog prints the message with its timestamp like:
```bash
$ [main.main] A debug log with calling function
```You can use both the configurations together also. Go gophers!
### Contributor
[Yashish Dua](https://github.com/yashishdua)### Show some :heart:
[![GitHub stars](https://img.shields.io/github/stars/MindorksOpenSource/Go-Log.svg?style=social&label=Star)](https://github.com/MindorksOpenSource/Go-Log) [![GitHub forks](https://img.shields.io/github/forks/MindorksOpenSource/Go-Log.svg?style=social&label=Fork)](https://github.com/MindorksOpenSource/Go-Log/fork) [![GitHub watchers](https://img.shields.io/github/watchers/MindorksOpenSource/Go-Log.svg?style=social&label=Watch)](https://github.com/MindorksOpenSource/Go-Log) [![GitHub followers](https://img.shields.io/github/followers/yashishdua.svg?style=social&label=Follow)](https://github.com/MindorksOpenSource/Go-Log)
[![Twitter Follow](https://img.shields.io/twitter/follow/duayashish.svg?style=social)](https://twitter.com/duayashish)