https://github.com/arriqaaq/qalam
Simple time based file writer used for writing files to disk
https://github.com/arriqaaq/qalam
buffers file-writing filesystem go golang
Last synced: 7 months ago
JSON representation
Simple time based file writer used for writing files to disk
- Host: GitHub
- URL: https://github.com/arriqaaq/qalam
- Owner: arriqaaq
- License: mit
- Created: 2018-04-23T12:06:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-15T06:22:08.000Z (over 6 years ago)
- Last Synced: 2025-03-25T12:51:03.836Z (7 months ago)
- Topics: buffers, file-writing, filesystem, go, golang
- Language: Go
- Size: 12.7 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# qalam
Simple time based filewriter to log data to disk. Has buffer support to flush data from memory to disk to reduce disk IO
Features
--------
- Create a simple log file handler, will do log rotation automatically
Installing
----------
```
go get -u github.com/arriqaaq/qalam
```
Example
-------
Here's a full example of a qalam that writes to a file with a (%Y%m%d) format:
You can run this example from a terminal:
```sh
go run example/main.go
```
```go
package main
import (
"github.com/arriqaaq/qalam"
"log"
"time"
)
func main() {
config := qalam.NewConfig("./log.%Y%m%d.gz", time.Local, 1, true, 10*time.Millisecond)
c, err := qalam.NewQalam(config)
if err != nil {
log.Fatalln(err)
}
c.Writeln([]byte("pogba"))
c.Writeln([]byte("kante"))
c.Close()
}
```
TODO
--------
- Add more test cases
- Add prometheus stats
- Add zap logger for debug purpose
References
--------
- https://www.devdungeon.com/content/working-files-go
Contact
-------
Farhan [@arriqaaq](http://twitter.com/arriqaaq)