Skip to content

Commit

Permalink
updated trace logs
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Feb 22, 2023
1 parent d38dca9 commit 35ef8f3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ EMPTY_TRASH=False
CLEAN_BUNDLES=False
OPTIMIZE_DB=False
TRACE=False
LOG_REQUESTS=False
```
### Base Options
Expand Down Expand Up @@ -269,11 +270,18 @@ Sleep Timer between Empty Trash, Clean Bundles, and Optimize DB in seconds that'
#### Trace
Run with every request and file action logged.
Run with extra trace logs.
* **Environment Variable:** `TRACE=True`
* **Shell Command:** `-tr` or `--trace`
#### Log Requests
Run with every request and file action logged.
* **Environment Variable:** `LOG_REQUESTS=True`
* **Shell Command:** `-lr` or `--log-requests`
### Continuous Schedule
Plex Image Cleanup can be run either immediately or on a schedule. The default behavior is to run immediately to run using a schedule simply pass in the `Schedule` Option.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.14
0.9.15
3 changes: 2 additions & 1 deletion config/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ PHOTO_TRANSCODER=False
EMPTY_TRASH=False
CLEAN_BUNDLES=False
OPTIMIZE_DB=False
TRACE=False
TRACE=False
LOG_REQUESTS=False
5 changes: 3 additions & 2 deletions plex_image_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ def not_failed(exception):
{"arg": "et", "key": "empty-trash", "env": "EMPTY_TRASH", "type": "bool", "default": False, "help": "Global Toggle to Run Plex's Empty Trash Operation."},
{"arg": "cb", "key": "clean-bundles", "env": "CLEAN_BUNDLES", "type": "bool", "default": False, "help": "Global Toggle to Run Plex's Clean Bundles Operation."},
{"arg": "od", "key": "optimize-db", "env": "OPTIMIZE_DB", "type": "bool", "default": False, "help": "Global Toggle to Run Plex's Optimize DB Operation."},
{"arg": "tr", "key": "trace", "env": "TRACE", "type": "bool", "default": False, "help": "Run with every request logged."}
{"arg": "tr", "key": "trace", "env": "TRACE", "type": "bool", "default": False, "help": "Run with extra trace logs."},
{"arg": "lr", "key": "log-requests", "env": "LOG_REQUESTS", "type": "bool", "default": False, "help": "Run with every request logged."}
]
script_name = "Plex Image Cleanup"
plex_db_name = "com.plexapp.plugins.library.db"
base_dir = os.path.dirname(os.path.abspath(__file__))
config_dir = os.path.join(base_dir, "config")
pmmargs = PMMArgs("meisnate12/Plex-Image-Cleanup", base_dir, options, use_nightly=False)
logger = logging.PMMLogger(script_name, "plex_image_cleanup", os.path.join(config_dir, "logs"), discord_url=pmmargs["discord"], log_requests=pmmargs["trace"])
logger = logging.PMMLogger(script_name, "plex_image_cleanup", os.path.join(config_dir, "logs"), discord_url=pmmargs["discord"], is_trace=pmmargs["trace"], log_requests=pmmargs["log-requests"])
logger.secret([pmmargs["url"], pmmargs["discord"], pmmargs["token"], quote(str(pmmargs["url"])), requests.utils.urlparse(pmmargs["url"]).netloc])
requests.Session.send = util.update_send(requests.Session.send, pmmargs["timeout"])
plexapi.BASE_HEADERS["X-Plex-Client-Identifier"] = pmmargs.uuid
Expand Down

0 comments on commit 35ef8f3

Please sign in to comment.