1
"""Helioviewer Python utility mehtods"""
5
def init_logger(filepath):
6
"""Initializes logging"""
7
# Check for logging directory
8
directory, filename = os.path.split(os.path.expanduser(filepath))
10
if not os.path.exists(directory):
11
os.makedirs(directory)
16
# e.g. Move previous log to hvpull.log.1, hvpull.log.1 to hvpull.log.2, etc
17
# and delete any logs greater than 10.
18
logging.basicConfig(filename=filename, level=logging.INFO,
19
format='%(asctime)s.%(msecs)03d [%(levelname)s] %(message)s',
20
datefmt='%Y-%m-%d %H:%M:%S')
22
# Also log INFO or higher messages to STDOUT
23
console = logging.StreamHandler()
24
console.setLevel(logging.INFO)
25
logging.getLogger('').addHandler(console)
b'\\ No newline at end of file'