2 Star 3 Fork 1

xuri / glc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT
GLC (glog cleaner)

GLC (glog cleaner)

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

简介

GLC (glog cleaner) 是 Go 语言编写的 glog 日志清理类库,glog 是由 Google 开发的一个应用级日志框架,提供了日志分级、文件切分等功能,但是暂未提供日志清理功能,配合 GLC 可以方便地实现日志清理功能,类库提供了自定义日志保留时间、日志文件名前缀匹配和清理扫描频率的支持。

安装

go get github.com/xuri/glc

使用方式

下面是一个简单的例子,每小时清理日志,仅保留 30 分钟内指定目录下以 glc 做前缀由 glog 产生的日志:

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

社区合作

欢迎您为此项目贡献代码,提出建议或问题、修复 Bug 以及参与讨论对新功能的想法。

开源许可

本项目遵循 MIT 开源许可协议,访问 LICENSE 查看许可协议文件。

The MIT License (MIT) Copyright (c) 2016 - 2020 Ri Xu All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

GLC (glog cleaner) is a log clear for glog written in Go. This library support for deleting old logs. 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/xurime/glc.git
git@gitee.com:xurime/glc.git
xurime
glc
glc
master

搜索帮助