glc

package module
v0.0.0-...-456f1e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 5 Imported by: 2

README

GLC (glog cleaner)

GLC (glog cleaner)

Build Status Code Coverage Go Report Card go.dev license Donate FOSSA Status

Overview

GLC (glog cleaner) is a log clear for glog written in Go. This library support for deleting old logs. There are tools which can be run to do the cleanup such as logrotate, but logrotate can't runs on Windows and embedded system, so we need a cross platform library to rotate the log.

Installation

go get github.com/xuri/glc

Usage

Here is a example usage that will do check every hour and clean the log files that creation time older than 30 minutes.

glc.NewGLC(glc.InitOption{
	Path:     path,
	Prefix:   `glc`,
	Interval: time.Duration(time.Hour),
	Reserve:  time.Duration(time.Minute * 30),
})

Contributing

Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.

Licenses

This program is under the terms of the MIT License. See LICENSE for the full license text.

FOSSA Status

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GLC

type GLC struct {
	// contains filtered or unexported fields
}

GLC define the glog cleaner options:

path     - Log files will be clean to this directory
prefix   - Log files name prefix
interval - Log files clean scanning interval
reserve  - Log files reserve time

func NewGLC

func NewGLC(option InitOption) *GLC

NewGLC create a cleaner in a goroutine and do instantiation GLC by given init options.

type InitOption

type InitOption struct {
	Path     string
	Prefix   string
	Interval time.Duration
	Reserve  time.Duration
}

InitOption define the glog cleaner init options for glc:

Path     - Log files will be clean to this directory
Prefix   - Log files name prefix
Interval - Log files clean scanning interval
Reserve  - Log files reserve time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL