https://github.com/kuloud/klog
Golang lightweight log component, support level control, file log...
https://github.com/kuloud/klog
Last synced: 8 months ago
JSON representation
Golang lightweight log component, support level control, file log...
- Host: GitHub
- URL: https://github.com/kuloud/klog
- Owner: kuloud
- License: apache-2.0
- Created: 2015-11-07T14:05:44.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-09T14:50:07.000Z (over 10 years ago)
- Last Synced: 2025-10-12T19:16:24.198Z (8 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Overview
Golang lightweight log component, support level control, file log...
Getting Started
---------------
```go
package main
import (
log "github.com/kuloud/klog"
)
func main() {
log.V("vTag", "hello", "kuloud")
log.Vf("vfTag", "%s, just like %s said.", "hello", "kuloud")
log.D("dTag", "hello", "kuloud")
log.Df("dfTag", "%s, just like %s said. %d", "hello", "kuloud", 1)
log.I("iTag", "hello", "kuloud")
log.If("ifTag", "%s, just like %s said. %t", "hello", "kuloud", true)
log.W("wTag", "hello", "kuloud")
log.Wf("wfTag", "%s, just like %s said. %s", "hello", "kuloud", "Debug")
log.E("eTag", "hello", "kuloud")
log.Ef("efTag", "%s, just like you said.")
}
```
Custom the config in config.go
run the example:
```
go run example.go
```
You will get like this
```
2015/11/07 23:35:07 [D]:[dTag] hello kuloud
2015/11/07 23:35:07 [D]:[dfTag] hello, just like kuloud said. 1
2015/11/07 23:35:07 [I]:[iTag] hello kuloud
2015/11/07 23:35:07 [I]:[ifTag] hello, just like kuloud said. true
2015/11/07 23:35:07 [W]:[wTag] hello kuloud
2015/11/07 23:35:07 [W]:[wfTag] hello, just like kuloud said. Debug
2015/11/07 23:35:07 [E]:[eTag] hello kuloud
2015/11/07 23:35:07 [E]:[efTag] %!s(MISSING), just like you said.
```
Installation and Upgrade
------------------------
```
$ go get -u github.com/Kuloud/Klog
```
History
-------
v1.0.0, 7 Nov 2015
------------------
* Initial release
** Level contorl
** File log
License
-------
Apache License Version 2.0. See [LICENSE](https://github.com/Kuloud/Klog/blob/master/LICENSE) file for details.
ToDo
----
* Load configuration by profile, such as xml/properties... Fix log file recreate each time.