Charles Leung
03/30/2023, 5:14 PM@flow
def api_flow(url):
# logger = get_run_logger()
logger = logging.getLogger()
#set lower level
logger.setLevel(<http://logging.INFO|logging.INFO>)
#create file handler
filehdlr = logging.FileHandler('filehandler.txt',mode='w')
# set level
filehdlr.setLevel(<http://logging.INFO|logging.INFO>)
# add handler to logger
logger.addHandler(filehdlr)
fact_json = call_api(url)
<http://logger.info|logger.info>("TEST")
return fact_json
But it only adds local outputs into the .txt file (filehandler.txt shown below):
file handler is created to handle log message in the file
we can create many handlers for the logger
Created task run 'call_api-0' for task 'call_api'
Executing 'call_api-0' immediately...
Finished in state Completed()
TEST
Finished in state Completed()
Is there a way I can get the exact flow logs (including the timestamps) saved somewhere (either onprem or on S3) like the output shown below from prefect?Bianca Hoch
03/30/2023, 5:17 PM