natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.79k stars 591 forks source link

Add configs: DirPermMode, RotateFilePattern interface #69

Closed wyxloading closed 5 years ago

wyxloading commented 5 years ago
  1. 59 add config: DirPermMode to overwrite defaultPermMode(0744)

  2. add RotateFilePattern to overwrite rotate file name pattern

  3. May expect create directories in perm: 0755

  4. Would like to overwrite rotate file pattern like: access.log.20181224.175210 that's much more convenient than access-2018XXX.log

natefinch commented 5 years ago

You can set the permissions of the directory by just creating the directory first, lumberjack won't change the existing permissions of the directory.

As for a user-defined file pattern... this is problematic, because if you ever change the pattern, lumberjack won't see the old files, and so it won't clean up the old files, and you could run out of disk space. You shouldn't care what the backup log file names are. The name has all the same info as your proposal.