#!/user/bin/env python3
#----------------------------------------------------#
# Script Name                Ops Challenge 16
# Author                     Kimberley Cabrera-Boggs
# Date of last revision      November 10, 2020
# Description of purpose     Event Logging
#----------------------------------------------------#
print("""

███████ ██    ██ ███████ ███    ██ ████████     ██       ██████   ██████   ██████  ██ ███    ██  ██████  
██      ██    ██ ██      ████   ██    ██        ██      ██    ██ ██       ██       ██ ████   ██ ██       
█████   ██    ██ █████   ██ ██  ██    ██        ██      ██    ██ ██   ███ ██   ███ ██ ██ ██  ██ ██   ███ 
██       ██  ██  ██      ██  ██ ██    ██        ██      ██    ██ ██    ██ ██    ██ ██ ██  ██ ██ ██    ██ 
███████   ████   ███████ ██   ████    ██        ███████  ██████   ██████   ██████  ██ ██   ████  ██████  
                                                                                                       
""")
#---------------------Import Libraries---------------#
import os
import logging
import time
from logging.handlers import TimedRotatingFileHandler
from logging.handlers import RotatingFileHandler

#---------------------Test One-----------------------#
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

handler = TimedRotatingFileHandler('timed_test.log', when='s', interval=5, backupCount=5)
logger.addHandler(handler)

for _ in range(6):
    logger.info('Hello World!')
    time.sleep(1)

#---------------------Test Two-----------------------#
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

handler = RotatingFileHandler('app.log', maxBytes=2000, backupCount=5)
logger.addHandler(handler)

for i in range(100):
    logger.info('Hello Out There!')
    print ("Logging Hello Out There! number", i)
   # os.system("ls -al")
    time.sleep(3)

#-----------------------End-------------------------#
