Here are the examples of the python api twisted.logger.jsonFileLogObserver taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
View Complete Implementation : logging.py
Copyright GNU Affero General Public License v3.0
Author : nucypher
Copyright GNU Affero General Public License v3.0
Author : nucypher
@lru_cache()
def get_json_file_observer(name="nucypher.json", path=USER_LOG_DIR):
_ensure_dir_exists(path)
logfile = LogFile(name=name, directory=path, rotateLength=MAXIMUM_LOG_SIZE, maxRotatedFiles=MAX_LOG_FILES)
observer = jsonFileLogObserver(outFile=logfile)
return observer
3
View Complete Implementation : estimate_gas.py
Copyright GNU Affero General Public License v3.0
Author : nucypher
Copyright GNU Affero General Public License v3.0
Author : nucypher
def start_collection(self) -> None:
print("Starting Data Collection...")
json_filepath = os.path.join(self.OUTPUT_DIR, yyyyzeGas.LOG_FILENAME)
json_io = io.open(json_filepath, "w")
json_observer = jsonFileLogObserver(json_io)
globalLogPublisher.addObserver(json_observer)
globalLogPublisher.addObserver(self)
0
View Complete Implementation : data_router.py
Copyright Apache License 2.0
Author : crownpku
Copyright Apache License 2.0
Author : crownpku
@staticmethod
def _create_query_logger(response_log):
"""Create a logger that will persist incoming query results."""
# Ensures different log files for different
# processes in multi worker mode
if response_log:
# We need to generate a unique file name,
# even in multiprocess environments
timestamp = datetime.datetime.now().strftime('%Y%m%d-%H%M%S')
log_file_name = "rasa_nlu_log-{}-{}.log".format(timestamp,
os.getpid())
response_logfile = os.path.join(response_log, log_file_name)
# Instantiate a standard python logger,
# which we are going to use to log requests
utils.create_dir_for_file(response_logfile)
query_logger = Logger(
observer=jsonFileLogObserver(
io.open(response_logfile, 'a', encoding='utf8'),
recordSeparator=''),
namespace='query-logger')
# Prevents queries getting logged with parent logger
# --> might log them to stdout
logger.info("Logging requests to '{}'.".format(response_logfile))
return query_logger
else:
# If the user didn't provide a logging directory, we wont log!
logger.info("Logging of requests is disabled. "
"(No 'request_log' directory configured)")
return None