daily pastebin goal
88%
SHARE
TWEET

Untitled

a guest Jan 13th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #coding:utf8
  2. import logging
  3. import asyncio
  4.  
  5. logger = logging.getLogger('__YOUR_APPLICATION__NAME___')
  6. logger.setLevel(logging.DEBUG)
  7. handler = logging.FileHandler(filename='log.txt', encoding='utf-8', mode='a')
  8. handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
  9. logger.addHandler(handler)
  10.  
  11. async def main():
  12.   logger.info("start")
  13.  
  14. if __name__ == '__main__':
  15.   loop = asyncio.get_event_loop()
  16.   loop.run_until_complete(main())
RAW Paste Data
Top