Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 6 hours 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 (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-01T11:30:23.000Z (7 months ago)
- Last Synced: 2024-06-19T05:43:27.305Z (5 months ago)
- Topics: asynchronously, log, merger
- Language: Go
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- 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 mainimport (
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.