From dd45e6a67c53f673bb49ca8a001fd3a63ceb640e Mon Sep 17 00:00:00 2001 From: Nate Finch Date: Fri, 4 Nov 2016 09:48:45 -0400 Subject: [PATCH] update docs w/ backup format info --- README.md | 8 ++++++++ lumberjack.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 9f8e698..9e97154 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,14 @@ the current file is closed, renamed, and a new log file created with the original name. Thus, the filename you give Logger is always the "current" log file. +Backups use the log file name given to Logger, in the form `name-timestamp.ext` +where name is the filename without the extension, timestamp is the time at which +the log was rotated formatted with the time.Time format of +`2006-01-02T15-04-05.000` and the extension is the original extension. For +example, if your Logger.Filename is `/var/log/foo/server.log`, a backup created +at 6:30pm on Nov 11 2016 would use the filename +`/var/log/foo/server-2016-11-04T18-30-00.000.log` + ### Cleaning Up Old Log Files Whenever a new logfile gets created, old log files may be deleted. The most recent files according to the encoded timestamp will be retained, up to a diff --git a/lumberjack.go b/lumberjack.go index 7014444..b4bb54f 100644 --- a/lumberjack.go +++ b/lumberjack.go @@ -55,6 +55,14 @@ var _ io.WriteCloser = (*Logger)(nil) // original name. Thus, the filename you give Logger is always the "current" log // file. // +// Backups use the log file name given to Logger, in the form +// `name-timestamp.ext` where name is the filename without the extension, +// timestamp is the time at which the log was rotated formatted with the +// time.Time format of `2006-01-02T15-04-05.000` and the extension is the +// original extension. For example, if your Logger.Filename is +// `/var/log/foo/server.log`, a backup created at 6:30pm on Nov 11 2016 would +// use the filename `/var/log/foo/server-2016-11-04T18-30-00.000.log` +// // Cleaning Up Old Log Files // // Whenever a new logfile gets created, old log files may be deleted. The most