tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

logger.py (1689B)


      1 #!/usr/bin/env python
      2 
      3 # This Source Code Form is subject to the terms of the Mozilla Public
      4 # License, v. 2.0. If a copy of the MPL was not distributed with this
      5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      6 
      7 from mozlog.proxy import ProxyLogger
      8 
      9 
     10 class RaptorLogger:
     11    app = ""
     12 
     13    def __init__(self, component=None):
     14        self.logger = ProxyLogger(component)
     15 
     16    def set_app(self, app_name):
     17        """Sets the app name to prefix messages with."""
     18        RaptorLogger.app = " [" + app_name + "]"
     19 
     20    def exception(self, message, **kwargs):
     21        self.critical(message, **kwargs)
     22 
     23    def debug(self, message, **kwargs):
     24        return self.logger.debug(f"Debug: {message}", **kwargs)
     25 
     26    def info(self, message, **kwargs):
     27        return self.logger.info(f"Info: {message}", **kwargs)
     28 
     29    def warning(self, message, **kwargs):
     30        return self.logger.warning(f"Warning:{RaptorLogger.app} {message}", **kwargs)
     31 
     32    def error(self, message, **kwargs):
     33        return self.logger.error(f"Error:{RaptorLogger.app} {message}", **kwargs)
     34 
     35    def critical(self, message, **kwargs):
     36        return self.logger.critical(f"Critical:{RaptorLogger.app} {message}", **kwargs)
     37 
     38    def log_raw(self, message, **kwargs):
     39        return self.logger.log_raw(message, **kwargs)
     40 
     41    def process_output(self, *args, **kwargs):
     42        return self.logger.process_output(*args, **kwargs)
     43 
     44    def crash(self, *args, **kwargs):
     45        return self.logger.crash(*args, **kwargs)
     46 
     47    def group_start(self, *args, **kwargs):
     48        return self.logger.group_start(*args, **kwargs)
     49 
     50    def group_end(self, *args, **kwargs):
     51        return self.logger.group_end(*args, **kwargs)