def test_exception_is_none_with_stdout(self): client = TestClient() client_context = ClientContext(client, "testid") logging.getLogger().setLevel(level=logging.DEBUG) YLogger.set_stdout("True") YLogger.exception(client_context, "Exception Log", None)
def test_set_stdout(self): client = TestClient() client_context = ClientContext(client, "testid") logging.getLogger().setLevel(level=logging.DEBUG) YLogger.set_stdout("True") YLogger.critical(client_context, "Critical Log") YLogger.fatal(client_context, "Fatal Log") YLogger.error(client_context, "Error Log") YLogger.exception(client_context, "Exception Log", Exception("test")) YLogger.warning(client_context, "Warning Log") YLogger.info(client_context, "Info Log") YLogger.debug(client_context, "Debug Log")
def __init__(self, id, argument_parser=None): RestBotClient.__init__(self, id, argument_parser) self.initialise() bot_name = "defaultbot" try: bot = self._bot_factory.select_bot() brain = bot._brain_factory.select_brain() bot_name = brain.configuration.bot_name YLogger.set_prefix(bot_name) except Exception: pass self._server_mode = True # if Not Server-Mode then change to comment line. YLogger.set_stdout(self.arguments.args.stdoutlog) YLogger.set_traceback(False)
def test_set_stdout_json(self): client = TestClient() client_context = ClientContext(client, "testid") logging.getLogger().setLevel(level=logging.DEBUG) YLogger.set_stdout("True") tmp_str = 'test' tmp_val = 99 YLogger.debug(client_context, '{"key_a":"%s", "key_b": "%d"}', tmp_str, tmp_val) YLogger.debug(client_context, '{"key_a":"%s", "key_b": "%d"}') json_data1 = '{"key_a":"%s", "key_b": "%d"}' % (tmp_str, tmp_val) YLogger.debug(client_context, 'json_data : "%s"', json_data1) json_data2 = '{"key_a":"%s", "key_b": "%d"}' YLogger.debug(client_context, 'json_data : "%s"', json_data2)