-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Use whole path as logfile when defined via -f #1455
Conversation
`profanity -f my` created ~/.local/share/profanity/logs/my.log`. It would be nicer if one could define the actual path, so one can choose another directory or even use /dev/null. Fixes #1442
This isn't finished yet. Need some opinion here. The problem, and probably also the reason why I chose to make -f use only the filename in a dir was to keep things simple (for me) :D We have So either we need to rewrite I'm for the latter since its much easier. Otherwise we need to take into account all kind of scenarios like. @wstrm whats your opinion? |
As long as we tell the user (in the console) once they've used |
Tell user about this change.
Not needed anymore.
@wstrm next question: does it make sense to do logfile rotation if the user provided a logfile with -f? I guess not. So it seems we need a way to detect whether a logfile is supplied anyways. And in this case don't rotate the logs? |
g_string_append(logfile, "/profanity/logs/"); | ||
g_string_append(logfile, log_file); | ||
gchar *log_path = g_path_get_dirname(log_file); | ||
if (!mkdir_recursive(log_path)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, maybe I should move the download directory creation to this file instead then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that would be possible.
Thanks! Works great!! As per the logfile rotation - I think it may make sense. removing the logfile with rm would not help infact in e.g.: freeing space, or management. |
See #1518 It has a good explanation of what happened: ``` Apparently, the _rotate_log_file function tried to extract user-provided name from currently used mainlogfile and restart logging to the same place after rotation, but currently this is interpreted as a full path instead. As I understand, the log rotation is no longer done with user-provided paths at all so this should be simply skipped altogether now as passing any non-NULL value is interpreted as user-provided. Replacing start with NULL appears to fix it for me. ``` In log_msg() we only rotate the log if not user_provided_log. #1455 changed the behaviour from user defined filename in the log dir to using full path.
profanity -f my
created ~/.local/share/profanity/logs/my.log`.It would be nicer if one could define the actual path, so one can choose
another directory or even use /dev/null.
Fixes #1442