@@ -66,6 +66,50 @@ def no_new_licenses():
6666def rate_limit (service , retry_after ):
6767 warn (f"{ service } API rate limit exceeded. Pausing operations for { retry_after } seconds before next attempt." )
6868
69+ # Log when starting comment stream for a subreddit
70+ def starting_stream (subreddit_name ):
71+ info (f"Starting comment stream for r/{ subreddit_name } " )
72+
73+ # Log when starting catch-up on missed comments
74+ def starting_catchup ():
75+ info ("Starting catch-up on missed comments" )
76+
77+ # Log when catch-up is completed
78+ def catchup_completed ():
79+ info ("Catch-up completed" )
80+
81+ # Log debug info for processed comment
82+ def processed_comment_debug (subreddit_name , found , new ):
83+ debug (f"Processed comment from r/{ subreddit_name } : found { found } license commands, { new } new" )
84+
85+ # Log when gist update fails after retries
86+ def gist_update_failed ():
87+ error ("Failed to update gist after multiple retries" )
88+
89+ # Log when latest gist update fails after retries
90+ def latest_gist_update_failed ():
91+ error ("Failed to update latest gist after multiple retries" )
92+
93+ # Log error in queue processing
94+ def queue_processing_error (error_msg ):
95+ error (f"Error processing queue: { error_msg } " )
96+
97+ # Log when queue worker starts
98+ def queue_worker_started ():
99+ info ("Queue worker started." )
100+
101+ # Log when health server starts
102+ def health_server_started (port ):
103+ info (f"Health check server started on port { port } " )
104+
105+ # Log when bot starts
106+ def bot_started (version ):
107+ info (f"ASFScan v{ version } started and monitoring subreddits..." )
108+
109+ # Log when bot shuts down
110+ def bot_shutting_down ():
111+ info ("Bot shutting down..." )
112+
69113# Make the logger functions available as module attributes
70114logger = {
71115 "info" : info ,
@@ -77,5 +121,16 @@ def rate_limit(service, retry_after):
77121 "processing_comment" : processing_comment ,
78122 "gist_update_success" : gist_update_success ,
79123 "no_new_licenses" : no_new_licenses ,
80- "rate_limit" : rate_limit
124+ "rate_limit" : rate_limit ,
125+ "starting_stream" : starting_stream ,
126+ "starting_catchup" : starting_catchup ,
127+ "catchup_completed" : catchup_completed ,
128+ "processed_comment_debug" : processed_comment_debug ,
129+ "gist_update_failed" : gist_update_failed ,
130+ "latest_gist_update_failed" : latest_gist_update_failed ,
131+ "queue_processing_error" : queue_processing_error ,
132+ "queue_worker_started" : queue_worker_started ,
133+ "health_server_started" : health_server_started ,
134+ "bot_started" : bot_started ,
135+ "bot_shutting_down" : bot_shutting_down
81136}
0 commit comments