Skip to content

Commit

Permalink
Merge pull request #664 from glensc/log-filename
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Dec 20, 2021
2 parents a8a47bb + 33d7de8 commit 7eee4e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/dist/
/docker-compose.override.yml
/last_update.log
/plextraktsync.log
/tests/.env
/tests/config.json
/trakt_cache.sqlite
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Academy Award Nominees" but might not be ideal for lists that are updated
often). Here are the execution times on my Plex server: First run - 1228
seconds, second run - 111 seconds

You can view sync progress in the `last_update.log` file which will be created.
You can view sync progress in the `plextraktsync.log` file which will be created.

## Commands

Expand Down
5 changes: 3 additions & 2 deletions plextraktsync/config.default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"log_debug_messages": false,
"logging": {
"append": false
"debug": false,
"filename": "plextraktsync.log",
"append": true
},
"cache": {
"path": "$PTS_CACHE_DIR/trakt_cache"
Expand Down
7 changes: 5 additions & 2 deletions plextraktsync/logging.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import logging

from .factory import factory
from .path import log_file


def initialize():
CONFIG = factory.config()
# global log level for all messages
log_level = logging.DEBUG if CONFIG['log_debug_messages'] else logging.INFO
if ("log_debug_messages" in CONFIG and CONFIG["log_debug_messages"]) or CONFIG["logging"]["debug"]:
log_level = logging.DEBUG
else:
log_level = logging.INFO
log_file = CONFIG["logging"]["filename"]
log_format = '%(asctime)s %(levelname)s:%(message)s'

# messages with info and above are printed to stdout
Expand Down

0 comments on commit 7eee4e8

Please sign in to comment.