def api_info(api_name, message, request=None): if request is not None: client = get_ip(request) log_info("API", "%s (%s): %s" % (api_name.upper(), client, message)) del client else: log_info("API", "%s (NO-IP): %s" % (api_name.upper(), message))
def run(self): self.running = True print('Starting Daemon "%s".' % self.entry.name) log_info('DAEMON', 'Starting Daemon "%s"..' % self.entry.name) try: self.entry.method() except Exception as threadError: log_error( 'DAEMON', 'Daemon "%s" encountered an error when running! Exception: "%s"' % (self.entry.name, str(threadError))) log_info('DAEMON', 'Daemon "%s" finished running.' % self.entry.name) self.running = False self.entry.del_stop()
def start_daemon(): log_stdout('DAEMON', 'DEBUG') log_info('DAEMON', 'Starting the Scorebot3 Daemon process..') daemon_thread = Daemon() daemon_thread.load_daemons(settings.DAEMON_DIR) log_debug( 'DAEMON', 'Loaded "%d" daemons, [%s]..' % (len(daemon_thread.daemons), ', '.join( [str(d.name) for d in daemon_thread.daemons]))) try: daemon_thread.start() while daemon_thread.running: pass except KeyboardInterrupt: daemon_thread.stop() log_info('DAEMON', 'Stopping SBE Daemon process..')
def write_score_log(): for score_event in SCORE_EVENTS: log_info(LOG_NAME, score_event) SCORE_EVENTS.remove(score_event)