From 187ae7ec8a3f64353101698e7b652a765a2fe856 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Thu, 7 Mar 2024 03:10:37 -0500 Subject: [PATCH] add --no-time option --- feedsbot/hooks.py | 11 ++++++++++- pyproject.toml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/feedsbot/hooks.py b/feedsbot/hooks.py index 8565638..d3dd0d3 100644 --- a/feedsbot/hooks.py +++ b/feedsbot/hooks.py @@ -15,6 +15,7 @@ is_not_known_command, ) from feedparser import FeedParserDict +from rich.logging import RichHandler from sqlalchemy import delete, func, select from .orm import Fchat, Feed, init, session_scope @@ -47,10 +48,18 @@ default=-1, help="the maximum number of feeds the bot will subscribe to before rejecting new unknown feeds, by default: -1 (infinite)", ) +cli.add_generic_option( + "--no-time", + help="do not display date timestamp in log messages", + action="store_false", +) @cli.on_init -def on_init(bot: Bot, _args: Namespace) -> None: +def on_init(bot: Bot, args: Namespace) -> None: + bot.logger.handlers = [ + RichHandler(show_path=False, omit_repeated_times=False, show_time=args.no_time) + ] for accid in bot.rpc.get_all_account_ids(): if not bot.rpc.get_config(accid, "displayname"): bot.rpc.set_config(accid, "displayname", "FeedsBot") diff --git a/pyproject.toml b/pyproject.toml index e15466a..06b3984 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ classifiers = [ "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", ] dependencies = [ - "deltabot-cli>=4.0.0,<5.0", + "deltabot-cli>=5.0.0,<6.0", "SQLAlchemy>=2.0.25,<3.0", "feedparser>=6.0.11,<7.0", "requests>=2.28.1,<3.0",