Skip to content

BoRuDar/gorotator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gorotator

The small library for a file rotation. Zero dependencies, only standart library.

Quick start

package main

import (
	"fmt"
	"github.com/BoRuDar/gorotator"
)

func main() {
	fr, err := gorotator.New(gorotator.Config{
		PathToDir:        "./testdir",
		FileName:         "file.log",
		MaxFileSize:      1 * gorotator.KB,
		MaxNumberOfFiles: 3,
		IsWindows:        true,
	})
	if err != nil {
		panic(err)
	}
	defer fr.Close()

	_, err = fmt.Fprintln(fr, "test")
	if err != nil {
		panic(err)
	}
}