Created
March 27, 2018 19:51
-
-
Save enijkamp/72e78d1ee6993d194a7c434fcb1b0afb to your computer and use it in GitHub Desktop.
tf logging
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
def init_log(path): | |
log = logging.getLogger() | |
log.setLevel(logging.INFO) | |
formatter_cs = logging.Formatter('%(message)s') | |
cs = logging.StreamHandler(sys.stdout) | |
cs.setLevel(logging.INFO) | |
cs.setFormatter(formatter_cs) | |
log.addHandler(cs) | |
log = logging.getLogger('tensorflow') | |
log.setLevel(logging.INFO) | |
log.handlers = [] | |
formatter_fh = logging.Formatter('%(asctime)s - %(message)s') | |
fh = logging.FileHandler(path) | |
fh.setLevel(logging.DEBUG) | |
fh.setFormatter(formatter_fh) | |
log.addHandler(fh) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment