Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orcaman/logler
logs to stdout/stderror and to loggly
https://github.com/orcaman/logler
Last synced: 28 days ago
JSON representation
logs to stdout/stderror and to loggly
- Host: GitHub
- URL: https://github.com/orcaman/logler
- Owner: orcaman
- License: mit
- Created: 2015-04-22T07:44:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-31T17:23:14.000Z (over 9 years ago)
- Last Synced: 2024-10-20T17:23:40.614Z (2 months ago)
- Language: Go
- Size: 97.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# logler
- logs to both stdout/stderror and to [loggly](http://www.loggly.com)
- sample rate for loggly (write only x% of requests to save money), except for emergency log level
- accepts json messages only for loggly, log api for trace
- output: LOG-LEVEL: yyyy/MM/dd hh:mm:ss message
- Trace/Info/Warn/Error/Emergency API
- automatically include file, line number and function name in logs## usage
```go
type JSON map[string]interface{}
func main() {
logger = logler.New(&logler.Options{
LogglyToken: "311-234324-2323-234324-2323423",
Component: "my-cool-server",
LogglySampleRate: 25 // (1-100), write only 25% of logs to loggly
})logger.Warn(JSON{"category": "test", "action": "foo", "label": "bar"})
}```
results in stdout:
```shell
WARNING: 2015/03/27 16:39:30 {"action":"foo","category":"test","label":"bar"}
```## license
MIT (see LICENSE file)