def start(logfile=None, application_name="ooniprobe"): daily_logfile = None if not logfile: logfile = config.basic.logfile log_folder = os.path.dirname(logfile) log_filename = os.path.basename(logfile) daily_logfile = DailyLogFile(log_filename, log_folder) txlog.msg( "Starting %s on %s (%s UTC)" % (application_name, otime.prettyDateNow(), otime.utcPrettyDateNow())) logging.basicConfig() python_logging = txlog.PythonLoggingObserver(application_name) if config.advanced.debug: python_logging.logger.setLevel(logging.DEBUG) else: python_logging.logger.setLevel(logging.INFO) txlog.startLoggingWithObserver(python_logging.emit) txlog.addObserver(txlog.FileLogObserver(daily_logfile).emit)
def createReport(self, options): self._writeln("###########################################") self._writeln("# OONI Probe Report for %s test" % options['name']) self._writeln("# %s" % otime.prettyDateNow()) self._writeln("###########################################") test_details = yield getTestDetails(options) self.writeReportEntry(test_details)
def start(): txlog.msg("Starting OONI on %s (%s UTC)" % (otime.prettyDateNow(), otime.utcPrettyDateNow())) logging.basicConfig() python_logging = txlog.PythonLoggingObserver() if config.advanced.debug: python_logging.logger.setLevel(logging.DEBUG) else: python_logging.logger.setLevel(logging.INFO) txlog.startLoggingWithObserver(python_logging.emit) txlog.addObserver(txlog.FileLogObserver(daily_logfile).emit)
def writeReportHeader(self, options): self.firstrun = False self._writeln("###########################################") self._writeln("# OONI Probe Report for %s test" % options['name']) self._writeln("# %s" % otime.prettyDateNow()) self._writeln("###########################################") client_geodata = {} if config.privacy.includeip or \ config.privacy.includeasn or \ config.privacy.includecountry or \ config.privacy.includecity: log.msg("Running geo IP lookup via check.torproject.org") client_ip = yield geodata.myIP() client_location = geodata.IPToLocation(client_ip) else: client_ip = "127.0.0.1" if config.privacy.includeip: client_geodata['ip'] = client_ip else: client_geodata['ip'] = "127.0.0.1" client_geodata['asn'] = None client_geodata['city'] = None client_geodata['countrycode'] = None if config.privacy.includeasn: client_geodata['asn'] = client_location['asn'] if config.privacy.includecity: client_geodata['city'] = client_location['city'] if config.privacy.includecountry: client_geodata['countrycode'] = client_location['countrycode'] test_details = {'start_time': otime.utcTimeNow(), 'probe_asn': client_geodata['asn'], 'probe_cc': client_geodata['countrycode'], 'probe_ip': client_geodata['ip'], 'test_name': options['name'], 'test_version': options['version'], } self.writeReportEntry(test_details)
def start(logfile=None, application_name="OONI"): daily_logfile = None if not logfile: logfile = config.basic.logfile log_folder = os.path.dirname(logfile) log_filename = os.path.basename(logfile) daily_logfile = DailyLogFile(log_filename, log_folder) txlog.msg("Starting %s on %s (%s UTC)" % (application_name, otime.prettyDateNow(), otime.utcPrettyDateNow())) logging.basicConfig() python_logging = txlog.PythonLoggingObserver() if config.advanced.debug: python_logging.logger.setLevel(logging.DEBUG) else: python_logging.logger.setLevel(logging.INFO) txlog.startLoggingWithObserver(python_logging.emit) txlog.addObserver(txlog.FileLogObserver(daily_logfile).emit)