adjustments for logging

This commit is contained in:
Believethehype 2024-11-07 11:00:41 +01:00
parent 8416ec785f
commit 53520175b2
3 changed files with 6 additions and 5 deletions

View File

@ -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..")

View File

@ -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

View File

@ -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