Skip to content

Commit b70beef

Browse files
committed
docs: clarify comments
1 parent cf751aa commit b70beef

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Manual rotation (e.g. on `SIGHUP`):
6666
```go
6767
import (
6868
"log"
69+
"os"
6970
"os/signal"
7071
"syscall"
7172

@@ -199,6 +200,7 @@ On each new log file creation, timberjack:
199200
| **Manual (custom reason)** | `Logger.RotateWithReason(s)` | When called | Immediate | No | N/A | **No** | `-<sanitized reason>` | Falls back to `Rotate()` behavior if `s` sanitizes to empty. |
200201

201202
> **Time zone:** scheduling and filename timestamps use UTC by default, or local time if `LocalTime: true`.
203+
> **Sanitized reason:** lowercase; `[a-z0-9_-]` only, trims edge, max 32.
202204
203205
## ⚠️ Rotation Notes & Warnings
204206

timberjack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type rotateAt [2]int
8181
// Backups use the log file name given to Logger, in the form:
8282
// `name-timestamp-<reason>.ext` where `name` is the filename without the extension,
8383
// `timestamp` is the time of rotation formatted as `2006-01-02T15-04-05.000`,
84-
// `reason` is "size" or "time" (or "manual" for explicit Rotate calls), and `ext` is the original extension.
84+
// `reason` is "size" or "time" (Rotate/auto), or a custom tag (RotateWithReason), and `ext` is the original extension.
8585
// For example, if your Logger.Filename is `/var/log/foo/server.log`, a backup created at 6:30pm on Nov 11 2016
8686
// due to size would use the filename `/var/log/foo/server-2016-11-04T18-30-00.000-size.log`.
8787
//

0 commit comments

Comments
 (0)