Last active
January 23, 2019 16:01
-
-
Save sireliah/1c69f4891d96fdddf82e221a11cac2a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from ansible.utils import display | |
| from ansible.module_utils.basic import * | |
| import logging | |
| import logging.handlers | |
| LOG_PATH = '/tmp/hi.log' | |
| log_handler = logging.handlers.WatchedFileHandler(filename=LOG_PATH) | |
| formatter = logging.Formatter( | |
| '%(asctime)s - %(levelname)s: %(message)s' | |
| ) | |
| log_handler.setFormatter(formatter) | |
| logger = logging.getLogger() | |
| logger.addHandler(log_handler) | |
| logger.setLevel(logging.DEBUG) | |
| while True: | |
| logger.info('hi') | |
| time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment