Skip to content

Commit

Permalink
no need to specify loglevel
Browse files Browse the repository at this point in the history
its already set by core module, and
can override with env var (HPI_LOGS) or
module specific (e.g.,: LOGGING_LEVEL_my_trakt_export)
  • Loading branch information
purarue committed Sep 6, 2023
1 parent eaa343a commit 0a8a23d
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion my/apple/privacy_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class config(user_config.privacy_export):
from my.core.common import mcachew


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


class Game(NamedTuple):
Expand Down
2 changes: 1 addition & 1 deletion my/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class config(user_config):
export_path: Paths


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def inputs() -> Sequence[Path]:
Expand Down
2 changes: 1 addition & 1 deletion my/blizzard/gdpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class config(user_config.gdpr):
from my.utils.input_source import InputSource


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def inputs() -> Sequence[Path]:
Expand Down
2 changes: 1 addition & 1 deletion my/chess/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class config(user_config.export):
export_path: Paths


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def inputs() -> Sequence[Path]:
Expand Down
2 changes: 1 addition & 1 deletion my/discord/data_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class config(user_config.data_export):
from urlextract import URLExtract # type: ignore[import]


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def _remove_suppression(text: str, first_index: int, second_index: int) -> str:
Expand Down
2 changes: 1 addition & 1 deletion my/facebook/gdpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class config(user_config.gdpr):
from my.utils.time import parse_datetime_sec


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)

FacebookJson = Dict[Any, Any]

Expand Down
2 changes: 1 addition & 1 deletion my/listenbrainz/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class config(user_config.export):
export_path: Paths


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def inputs() -> Sequence[Path]:
Expand Down
2 changes: 1 addition & 1 deletion my/mal/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class mal_config(user_config.export):
config = make_config(mal_config)


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


# malexport supports multiple accounts
Expand Down
17 changes: 8 additions & 9 deletions my/mpv/history_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@ class mpv_config(user_config.history_daemon):
from my.core import get_files, Stats, LazyLogger
from my.utils.input_source import InputSource

# monkey patch logs
if "HPI_LOGS" in os.environ:
from logzero import setup_logger # type: ignore[import]
from my.core.logging import mklevel
import mpv_history_daemon.events

mpv_history_daemon.events.logger = setup_logger(
name="mpv_history_events", level=mklevel(os.environ["HPI_LOGS"])
)
logger = LazyLogger(__name__)

# monkey patch logs

from logzero import setup_logger # type: ignore[import]
import mpv_history_daemon.events

logger = LazyLogger(__name__, level="warning")
mpv_history_daemon.events.logger = setup_logger(
name="mpv_history_events", level=logger.level
)

Results = Iterator[Media]

Expand Down
2 changes: 1 addition & 1 deletion my/skype/gdpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class config(user_config.gdpr):
from my.core import get_files, LazyLogger
from my.utils.input_source import InputSource

logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


Results = Iterator[datetime]
Expand Down
5 changes: 3 additions & 2 deletions my/trakt/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class config(user_config.export):
export_path: Paths


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def inputs() -> Sequence[Path]:
Expand Down Expand Up @@ -59,7 +59,8 @@ def likes() -> Iterator[D.Like]:
yield from _read_trakt_exports().likes


@mcachew(depends_on=_cachew_depends_on, logger=logger)
# TODO: hmm, cachew seems to fail with this one, not sure why
# @mcachew(depends_on=_cachew_depends_on, logger=logger)
def watchlist() -> Iterator[D.WatchListEntry]:
yield from _read_trakt_exports().watchlist

Expand Down
2 changes: 1 addition & 1 deletion my/twitch/gdpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class config(user_config.gdpr):
from my.core.common import get_files, LazyLogger, mcachew, Stats
from my.utils.input_source import InputSource

logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def inputs() -> Sequence[Path]:
Expand Down
2 changes: 1 addition & 1 deletion my/twitch/overrustle_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class config(user_config.overrustle):

from .common import Event, Results

logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def inputs() -> Sequence[Path]:
Expand Down
2 changes: 1 addition & 1 deletion my/zsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class config(user_config):
live_file: Optional[PathIsh]


logger = LazyLogger(__name__, level="warning")
logger = LazyLogger(__name__)


def backup_inputs() -> Sequence[Path]:
Expand Down

0 comments on commit 0a8a23d

Please sign in to comment.