beeker1121 / creek

A simple log rotator for Go on Linux platforms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creek GoDoc License Go Report Card Build Status

A simple log rotator for Go on Linux platforms.

Usage

Creek is meant to be used with the standard log library.

The New method accepts a file to log to, as well as the max size, in megabytes, of each log file before rolling.

Sample usage:

package main

import (
	"log"

	"creek"
)

func main() {
	// Create a new logger that stores to a http.log file
	// with a max size of 10 MB before rolling over.
	logger := log.New(creek.New("/var/log/your_app/http.log", 10), "Logged: ", log.Lshortfile|log.LstdFlags)

	// Print to the log.
	logger.Println("Testing the log file")
}

About

A simple log rotator for Go on Linux platforms.

License:MIT License


Languages

Language:Go 100.0%