https://github.com/rosbit/logmerger
A utility package which can be used to process log file asynchronously
https://github.com/rosbit/logmerger
asynchronously log merger
Last synced: 8 months ago
JSON representation
A utility package which can be used to process log file asynchronously
- Host: GitHub
- URL: https://github.com/rosbit/logmerger
- Owner: rosbit
- License: mit
- Created: 2019-05-22T08:12:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-01T11:30:23.000Z (about 2 years ago)
- Last Synced: 2025-08-13T21:15:42.042Z (11 months ago)
- Topics: asynchronously, log, merger
- Language: Go
- Size: 4.88 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# logmerger
A utility package which can be used to process log file asynchronously.
## Archtecture
```
+---------------+ +---------------------+ <--- log-files such as:
log-generator --->+ log-file +---> logmerger ---> + log-files-with-date | log-file_20190522
+---------------+ | +----------+----------+ log-file_20190523
V ^ log-file_2019....
+------------+-------------+ |
| current-log-file-content +--------+
+------------+-------------+
|
V
one-log-file-handler
```
## Usage
```go
package main
import (
lm "github.com/rosbit/logmerger"
"fmt"
)
func main() {
m := lm.NewLogMerger(100) // time interval to check the existence of log-file
m.Run("log-file-name.here", sampleLogFileHandler) // use go m.Run(...) if you don't want to block
}
func sampleLogFileHandler(fileName string) {
fmt.Printf("process file %s as you need here\n", fileName)
// make sure the log-file not be opened
}
```
## Status
The package is fully tested.