https://github.com/gjbae1212/go-relogger
It is a logger that supports to reopen logging file when traps signal or is passed a time interval.
https://github.com/gjbae1212/go-relogger
go golang logger refresh reopen
Last synced: about 1 year ago
JSON representation
It is a logger that supports to reopen logging file when traps signal or is passed a time interval.
- Host: GitHub
- URL: https://github.com/gjbae1212/go-relogger
- Owner: gjbae1212
- License: mit
- Created: 2020-03-09T05:00:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-10T02:09:20.000Z (over 6 years ago)
- Last Synced: 2025-02-17T05:25:07.371Z (over 1 year ago)
- Topics: go, golang, logger, refresh, reopen
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-relogger
## Overview
**go-relogger** is a logger that supports to reopen logging file when traps signal or is passed a time interval.
It can use to the logrotate(current logging file moves to an other logging file with suffix).
> Because a logger prints previous logging file until logger reopens.
## Getting Started
```go
package main
import (
"os"
"time"
"github.com/gjbae1212/go-relogger"
)
func main() {
logger, err := NewReLogger("your-log-path", relogger.WithSignals([]os.Signal{
syscall.SIGHUP}),
relogger.WithRefreshDuration(time.Hour))
}
```
## LICENSE
This project is following The MIT.