Skip to content

Commit

Permalink
Merge pull request #6 from srfoster65:chore
Browse files Browse the repository at this point in the history
minor updates to docs and support files
  • Loading branch information
srfoster65 authored Oct 22, 2023
2 parents 5085a8e + 1fbd752 commit 5e46ea6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 42 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,3 @@ test-results.xml

# vscode config files
/.vscode/

35 changes: 2 additions & 33 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,28 @@ configure_logging(**vars(args))
Your script will now accept additional CLI paramaters to configure logging at runtime as shown below.

```python
usage: myscript.py [-h] [-v | --slc_level LEVELS] [--slc_modules [MODULES ...]] [--slc_log_file_path LOG_FILE_PATH]
[--slc_backup_count BACKUP_COUNT] [--slc_config {dual,dual_rotating,dual_detailed,console,file,rotating_file}]
usage: myscript.py [-h] [-v | --slc-level LEVELS] [--slc-modules [MODULES ...]] [--slc-log-file-path LOG_FILE_PATH]
[--slc-backup-count BACKUP_COUNT] [--slc-config {dual,dual_rotating,dual_detailed,console,file,rotating_file}]

Test Program

options:
-h, --help show this help message and exit
-v, --verbose The level of logging verbosity for the default handler. Use multiple times (up to -vvv) for increased
verbosity.
--slc_level LEVELS, --slc_levels LEVELS
--slc-level LEVELS, --slc-levels LEVELS
The log level(s) to be applied to attached handlers. This value can be a single integer or a string
representing a defined log level. Or it can be a string representing a dictionary where key/value pairs
are handler names and the log level to be associated with that handler
--slc_modules [MODULES ...]
--slc-modules [MODULES ...]
The names of the modules to be logged. If omitted all modules are logged.
--slc_log_file_path LOG_FILE_PATH
--slc-log-file-path LOG_FILE_PATH
The path the log file will be saved to. If this is a folder, the log file will be saved to this folder
with the file name derived from the name of the calling script. Otherwise, assume this is a full path to
a named log file.
--slc_backup_count BACKUP_COUNT
--slc-backup-count BACKUP_COUNT
An integer specifying The number of backup log files to retain.
--slc_config {dual,dual_rotating,dual_detailed,console,file,rotating_file}
--slc-config {dual,dual_rotating,dual_detailed,console,file,rotating_file}
The name of the logging config to be used.

```
Expand Down
13 changes: 12 additions & 1 deletion tests/test_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@

import logging

import pytest

from simple_logging_config import configure_logging


logger = logging.getLogger(__name__)


@pytest.fixture(scope="function", autouse=True)
def configure():
"""
Ensure logging is reset after each test.
"""
yield
configure_logging().reset()


class TestPrintFunctions:
"""
Class to test default config .
Expand All @@ -21,7 +32,7 @@ def test_str(self):
"""
slc = configure_logging()
out = str(slc)
assert ("Logging config: dual" in out)
assert "Logging config: dual" in out

def test_repr(self):
"""
Expand Down

0 comments on commit 5e46ea6

Please sign in to comment.