Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cattrs = {version="==23.2.3", python_version=">='3.7'"}
certifi = "==2023.11.17"
charset-normalizer = "==3.3.2"
click = "==8.1.7"
cysystemd = {version="==1.6.0", sys_platform="=='linux'"}
deprecated = "==1.2.14"
idna = {version="==3.6", python_version=">='3.5'"}
inquirerpy = "==0.3.4"
Expand Down
10 changes: 9 additions & 1 deletion Pipfile.lock

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

11 changes: 11 additions & 0 deletions plextraktsync/commands/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ def sync(
"""

logger.info(f"PlexTraktSync [{factory.version.full_version}]")
logger.info("System-D journal: red:0", extra={"PRIORITY": "0"})
logger.info("System-D journal: red:1", extra={"PRIORITY": "1"})
logger.info("System-D journal: red:2", extra={"PRIORITY": "2"})
logger.info("System-D journal: red:#", extra={"PRIORITY": "3"})
logger.info("System-D journal: green", extra={"PRIORITY": "4"})
logger.info("System-D journal: bold", extra={"PRIORITY": "5"})
logger.info("System-D journal: norm:6", extra={"PRIORITY": "6"})
logger.info("System-D journal: gray", extra={"PRIORITY": "7"})
logger.info("System-D journal: norm:8", extra={"PRIORITY": "8"})
logger.info("Override SYSLOG_IDENTIFIER", extra={"SYSLOG_IDENTIFIER": "PlexTraktSync.SYSLOG_IDENTIFIER"})
logger.info("Override LOGGER_NAME", extra={"LOGGER_NAME": "PlexTraktSync.LOGGER_NAME"})

movies = sync_option in ["all", "movies"]
shows = sync_option in ["all", "tv", "shows"]
Expand Down
6 changes: 6 additions & 0 deletions plextraktsync/logger/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re

from plextraktsync.factory import factory
from plextraktsync.logger.systemd import systemd_handler


def initialize(config):
Expand All @@ -26,6 +27,11 @@ def initialize(config):
file_handler,
console_handler,
]
if systemd_handler:
systemd_handler.setFormatter(
CustomFormatter("%(message)s")
)
handlers.append(systemd_handler)
logging.basicConfig(handlers=handlers, level=log_level, force=True)

# Set debug for other components as well
Expand Down
8 changes: 8 additions & 0 deletions plextraktsync/logger/systemd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
systemd_handler = None

try:
from cysystemd.journal import JournaldLogHandler

systemd_handler = JournaldLogHandler()
except ImportError:
pass
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cattrs==23.2.3; python_version >= '3.7' and python_version >= '3.8'
certifi==2023.11.17; python_version >= '3.6'
charset-normalizer==3.3.2; python_full_version >= '3.7.0'
click==8.1.7; python_version >= '3.7'
cysystemd==1.6.0; python_version >= '3.7' and python_version < '4' and sys_platform == 'linux'
deprecated==1.2.14; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
idna==3.6; python_version >= '3.5'
inquirerpy==0.3.4; python_version >= '3.7' and python_version < '4.0'
Expand Down