Skip to content

Commit

Permalink
Disable tuf file logging (#154)
Browse files Browse the repository at this point in the history
* Added a function for fully disabling tuf and securesystemslib file logging

* Updated changelog

* Fixed a typo
  • Loading branch information
renatav authored Oct 16, 2020
1 parent caea743 commit 7102d4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning][semver].

### Added

- Add support for fully disabling tuf logging ([154])
- Add support for including additional custom information when exporting historical data ([147])

### Changed
Expand All @@ -20,7 +21,10 @@ and this project adheres to [Semantic Versioning][semver].
- Minor YubiKey mock fix ([153])
- Updated some git methods so that it is checked if the returned value is not `None` before calling strip ([153])


[154]: https://github.com/openlawlibrary/taf/pull/154
[153]: https://github.com/openlawlibrary/taf/pull/153
[147]: https://github.com/openlawlibrary/taf/pull/147


## [0.6.1] - 09/09/2020
Expand All @@ -33,9 +37,7 @@ and this project adheres to [Semantic Versioning][semver].

### Fixed

[153]: https://github.com/openlawlibrary/taf/pull/153
[148]: https://github.com/openlawlibrary/taf/pull/148
[147]: https://github.com/openlawlibrary/taf/pull/147

## [0.6.0] - 08/11/2020

Expand Down
11 changes: 10 additions & 1 deletion taf/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ def disable_tuf_console_logging():
pass


def disable_tuf_file_logging():
if tuf.log.file_handler is not None:
tuf.log.disable_tuf_file_logging()
else:
logging.getLogger("tuf").setLevel(logging.CRITICAL)
logging.getLogger("securesystemslib_keys").setLevel(logging.CRITICAL)
logging.getLogger("securesystemslib_util").setLevel(logging.CRITICAL)


def _get_log_location():
location = settings.LOGS_LOCATION or os.environ.get("TAF_LOG")
if location is None:
Expand Down Expand Up @@ -71,4 +80,4 @@ def _get_log_location():
pass
else:
# if file logging is disabled, also disable tuf file logging
tuf.log.disable_file_logging()
disable_tuf_file_logging()

0 comments on commit 7102d4b

Please sign in to comment.