From 53520175b2f0cd94223887291e4e548ecdb12b63 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:00:41 +0100 Subject: [PATCH] adjustments for logging --- .../tasks/content_discovery_currently_popular_mostr.py | 8 ++++---- nostr_dvm/utils/dvmconfig.py | 2 +- tests/otherstuff.py | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py index 70e56df..d294522 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py @@ -55,7 +55,7 @@ class DicoverContentCurrentlyPopularMostr(DVMTaskInterface): use_logger = False if use_logger: - init_logger(LogLevel.DEBUG) + init_logger(self.dvm_config.LOGLEVEL) if self.dvm_config.UPDATE_DATABASE: await self.sync_db() @@ -150,7 +150,7 @@ class DicoverContentCurrentlyPopularMostr(DVMTaskInterface): # print(EventId.parse(entry[0]).to_bech32() + "/" + EventId.parse(entry[0]).to_hex() + ": " + str(entry[1])) e_tag = Tag.parse(["e", entry[0]]) result_list.append(e_tag.as_vec()) - if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: + if self.dvm_config.LOGLEVEL.value == LogLevel.DEBUG.value: print("[" + self.dvm_config.NIP89.NAME + "] Filtered " + str( len(result_list)) + " fitting events.") # await cli.shutdown() @@ -208,7 +208,7 @@ class DicoverContentCurrentlyPopularMostr(DVMTaskInterface): # Notes, reactions, zaps # filter = Filter().author(keys.public_key()) - if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: + if self.dvm_config.LOGLEVEL.value == LogLevel.DEBUG.value: print("[" + self.dvm_config.NIP89.NAME + "] Syncing notes of the last " + str( self.db_since) + " seconds.. this might take a while..") @@ -222,7 +222,7 @@ class DicoverContentCurrentlyPopularMostr(DVMTaskInterface): await cli.database().delete(Filter().until(Timestamp.from_secs( Timestamp.now().as_secs() - self.db_since))) # Clear old events so db doesn't get too full. await cli.shutdown() - if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: + if self.dvm_config.LOGLEVEL.value == LogLevel.DEBUG.value: print( "[" + self.dvm_config.NIP89.NAME + "] Done Syncing Notes of the last " + str( self.db_since) + " seconds..") diff --git a/nostr_dvm/utils/dvmconfig.py b/nostr_dvm/utils/dvmconfig.py index f4f9482..e6c0cfe 100644 --- a/nostr_dvm/utils/dvmconfig.py +++ b/nostr_dvm/utils/dvmconfig.py @@ -56,7 +56,7 @@ class DVMConfig: SCHEDULE_UPDATES_SECONDS = 0 UPDATE_DATABASE = True # DVMs that use a db manage their db by default. If a dvm should use the same db as another DVM, deactive it for those who do. CUSTOM_PROCESSING_MESSAGE = None - LOGLEVEL = LogLevel.DEBUG + LOGLEVEL = LogLevel.INFO KIND = None DVM_KEY = None diff --git a/tests/otherstuff.py b/tests/otherstuff.py index 459f096..d1f45b4 100644 --- a/tests/otherstuff.py +++ b/tests/otherstuff.py @@ -239,6 +239,7 @@ def build_botfarms(name, identifier, announce): dvm_config = build_default_config(identifier) dvm_config.USE_OWN_VENV = False dvm_config.SHOWLOG = True + dvm_config.UPDATE_DATABASE = False dvm_config.SCHEDULE_UPDATES_SECONDS = 600 # Every 10 seconds admin_config = AdminConfig() admin_config.LUD16 = dvm_config.LN_ADDRESS