https://github.com/morikuni/gaelog
Logging library for GAE/Go.
https://github.com/morikuni/gaelog
appengine appengine-go gae go golang log
Last synced: 5 months ago
JSON representation
Logging library for GAE/Go.
- Host: GitHub
- URL: https://github.com/morikuni/gaelog
- Owner: morikuni
- License: mit
- Created: 2018-04-19T02:02:13.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-23T06:14:33.000Z (about 8 years ago)
- Last Synced: 2024-06-20T01:49:56.715Z (almost 2 years ago)
- Topics: appengine, appengine-go, gae, go, golang, log
- Language: Go
- Homepage:
- 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
# gaelog
[](https://circleci.com/gh/morikuni/gaelog/tree/master)
[](https://godoc.org/github.com/morikuni/gaelog)
[](https://goreportcard.com/report/github.com/morikuni/gaelog)
[](https://codecov.io/gh/morikuni/gaelog)
Logging library for GAE/Go.
## Example
```go
package main
import (
"context"
"time"
"github.com/morikuni/gaelog"
)
func main() {
ctx := context.Background()
logger := &gaelog.CustomLogger{
RotationStrategy: gaelog.TimeBaseRotation{time.Hour}, // Rotate the log every hour.
OnUnexpectedError: func(err error) { panic(err) },
}
// You can clean up the old logs, leaving latest 1 day logs.
go gaelog.ScheduleCleanup(ctx, time.Hour, logger, gaelog.LeaveLatest{24 * time.Hour})
logger.Infof(ctx, "hello %s", "world")
logger.Printf(ctx, gaelog.Error, "log level error")
}
```