rlog

package module
v0.0.0-...-789b3fa Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

README

repi-rlog

项目介绍
  • 使用单个 file 对象
  • 自动备份日志包
  • 保留最近3天的目录
use packages:
安装

go get gitee.com/go-leader/repi-rlog

使用说明
    rl := rlog.GetFile("log/test.log")
    //logrus
    log := rl.GetLogger()
    log.Infof("test info %d", 1)
    //file
    f := rl.GetFile()
    log.Out = f
参与贡献
  1. Fork 本项目
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
码云特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. 码云官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解码云上的优秀开源项目
  4. GVP 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
  5. 码云官方提供的使用手册 http://git.mydoc.io/
  6. 码云封面人物是一档用来展示码云会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Cron *cron.Cron
)
View Source
var (
	//Delimiter ...  文件夹目录分隔符
	Delimiter = func() string {
		if runtime.GOOS == "windows" {
			return "\\"
		}
		return "/"
	}()
)

Functions

func CopyFile

func CopyFile(dstName, srcName string) (written int64, err error)

CopyFile ...

func GetFileSize

func GetFileSize(file *os.File) (int64, error)

GetFileSize 获取当前文件大小 kb >>10 , mb >>1e2

func TodayDir

func TodayDir(file *os.File) string

TodayDir 获取当前日期目录

Types

type ByteSize

type ByteSize uint64

ByteSize ...

const (
	KB ByteSize = 1 << (10 * iota) // 1 << (10*1)
	MB                             // 1 << (10*2)
	GB                             // 1 << (10*3)
	TB                             // 1 << (10*4)

)

kb,mb,gb

type File

type File struct {
	Logger *Logger
	// contains filtered or unexported fields
}

File ...

func GetFile

func GetFile(fName string) *File

GetFile ...

func (*File) GetFile

func (fl *File) GetFile() *os.File

GetFile ...

func (*File) GetLogger

func (fl *File) GetLogger() *Logger

GetLogger ...

func (*File) Reload

func (fl *File) Reload()

Reload reload file pointer

type Logger

type Logger struct {
	*logrus.Logger
}

Logger ...

Jump to

Keyboard shortcuts

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