Skip to content

Conversation

@AdwaitSalankar
Copy link
Contributor

@AdwaitSalankar AdwaitSalankar commented Mar 12, 2024

Description

Added a checkbox which enables logging to a file

Related Issue

Fixes #1705

How Has This Been Tested?

When checkbox was disabled the logs did not appear in vorta.log

Screenshot

Screenshot from 2024-03-13 00-17-05

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@AdwaitSalankar
Copy link
Contributor Author

@m3nu Can you review this PR?


formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

fh = TimedRotatingFileHandler(config.LOG_DIR / 'vorta.log', when='d', interval=1, backupCount=5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point config.LOG_DIR isn't initalized correctly yet. The following lines need to be executed first:

if want_development:
# if we're using the default dev dir
if want_development is DEFAULT_DIR_FLAG:
config.init_dev_mode(config.default_dev_dir())
else:
# if we're not using the default dev dir and
# instead we're using whatever dir is passed as an argument
config.init_dev_mode(want_development)
init_logger(background=want_background)

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.

Disable logging to file in Settings

2 participants