Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging file format #4

Closed
JamesCullum opened this issue Sep 14, 2016 · 3 comments
Closed

Logging file format #4

JamesCullum opened this issue Sep 14, 2016 · 3 comments

Comments

@JamesCullum
Copy link

JamesCullum commented Sep 14, 2016

  • The date part should come first in the filename, so that its possible to order the files alphabetically and immediately jump to the right day
  • The log files should not contain nanoseconds

Maybe allow to set placeholders so everybody can make the names like they want? I don't want my hostname or the file of my script in the filename of logs but others may want that.

Thanks already for consideration and the fast changes last time! 👍

@antigloss
Copy link
Owner

On vacation now. I'll take a look into this issue as soon as I'm home.

@antigloss
Copy link
Owner

  1. You can always order your file by "Last Modified Time", that's a basic function provided by the Windows File Browser.
  2. Nanosecond is there because I want to create a unique file each time my program restarts. I'm considering change the datetime format to be more human readable.
  3. To allow customizing the filename format will take some time, I'll do it but I'm a bit busy recently, so it won't be quick. If you do not want the hostname or program name appearing in the filename, please fork my code and modify it.

@antigloss
Copy link
Owner

Hi.
I've changed the filename format to PREFIX.SEVERITY_LEVEL.DATE_TIME.log. Now you can customize the prefix by calling logger.SetFilenamePrefix("logfilename_prefix", "symlink_filename_prefix"). If you don't want any prefix, just simply pass empty strings as its arguments.
Please refer to the document to logger.SetFilenamePrefix() for more information.

DATE_TIME is placed at the end of the filename purposefully to implement logfile auto rotation easily and efficiently. As I've mentioned before, we can always order the logfiles by Last Modified Time, so I don't think it's necessary to place the DATE_TIME at the beginning of the filename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants