Skip to content
/ qalam Public

Simple time based file writer used for writing files to disk

License

Notifications You must be signed in to change notification settings

arriqaaq/qalam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

go run example/main.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

Contact

Farhan @arriqaaq

About

Simple time based file writer used for writing files to disk

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages