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

Allow logging to a file #123

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Allow logging to a file #123

merged 1 commit into from
Jan 4, 2024

Conversation

skx
Copy link
Owner

@skx skx commented Dec 30, 2023

In #122 we updated our codebase to ensure that we used a common logging handle to send our output messages to the user:

  • This included warnings and errors by default.
  • However "developer", or other internal messages, were also available.

This pull-request builds upon that work to write the log messages to a file, as well as showing them to the user. By default a file rss2email.log is generated when the application starts and log entries are appended to it.

However:

  • LOG_FILE_PATH can be set to a different path.
  • LOG_FILE_DISABLE can be used to disable this duplication.

Why do this? Partly for reference, but also partly to allow a local setup to view errors.

We could now resolve #119 by adding a cronjob:

    #!/bin/sh
    # show logs, and delete them, run once per day
    cat .../rss2email.log
    rm .../rss2email.log

(Of course this might not work 100% as the current approach assumes the file is open forever in the case of daemon sub-command.)

This isn't a complete solution, but without getting into the whole template-customization and more complex considerations it's not a terrible thing to do.

In #122 we updated our codebase to ensure that we used a common
logging handle to send our output messages to the user:

* This included warnings and errors by default.
* However "developer", or other internal messages, were also available.

This pull-request builds upon that work to write the log messages to
a file, as well as showing them to the user.  By default a file
`rss2email.log` is generated when the application starts and log
entries are appended to it.

However:

* LOG_FILE_PATH can be set to a different path.
* LOG_FILE_DISABLE can be used to disable this duplication.

Why do this?  Partly for reference, but also partly to allow a local
setup to view errors.

We could now resolve #119 by adding a cronjob:

        #!/bin/sh
        # show logs, and delete them, run once per day
        cat .../rss2email.log
        rm .../rss2email.log

(Of course this might not work 100% as the current approach assumes
the file is open forever in the case of `daemon` sub-command.)

This isn't a complete solution, but without getting into the whole
template-customization and more complex considerations it's not a
terrible thing to do.
@skx skx merged commit 9300357 into master Jan 4, 2024
3 checks passed
@skx skx deleted the log-file branch January 4, 2024 07:22
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

Successfully merging this pull request may close these issues.

[Feature Request]: Feed notification on fetching error
1 participant