https://github.com/libgolang/log-prev
Logging Library
https://github.com/libgolang/log-prev
go golang log logger logging
Last synced: 6 months ago
JSON representation
Logging Library
- Host: GitHub
- URL: https://github.com/libgolang/log-prev
- Owner: libgolang
- License: apache-2.0
- Created: 2018-04-25T17:26:41.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-04T17:50:11.000Z (almost 8 years ago)
- Last Synced: 2024-06-20T14:20:39.525Z (about 2 years ago)
- Topics: go, golang, log, logger, logging
- Language: Go
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Logger
[](https://godoc.org/github.com/libgolang/log)
[](https://goreportcard.com/report/github.com/libgolang/log)
[](LICENSE)
[](https://github.com/libgolang/log/releases)
## Download
go get -u github.com/libgolang/log
## Simple Usage
package main
import (
"github.com/libgolang/log"
)
func main() {
// debug level
log.GetDefaultWriter().SetLevel(log.WARN)
// sets trace
log.SetTrace(true)
log.Debug("This is a debugging statement ... won't show")
log.Info("This is a debugging statement ... won't show")
log.Warn("This is a debugging statement ... will show")
log.Error("This is a debugging statement ... will show")
}
## Configuration Environment Variables
// Path to configuration file
export LOG_CONFIG=/path/to/config.properties
// Override Global Debug Level
export LOG_LEVEL=DEBUG
### Exampe config.properties
#
# Global Debug Level
# Default: WARN
log.level=DEBUG
#
# Enable Trace. This might be a slow operation
# Default: false
log.trace=true
#
# Define a log writer. By default there is one writer to stdout
#
log.writer.logger0.type=stdout
#
# Define a log writer to a file
#
log.writer.logger1.type=file
log.writer.logger1.name=one
log.writer.logger1.level=INFO
log.writer.logger1.maxfiles=10
log.writer.logger1.maxSize=1073741824
log.writer.logger1.dir=./log