Skip to content

Commit

Permalink
SVCPLAN-6428: Modify error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
PhongT16 committed Dec 2, 2024
1 parent e1e18b7 commit afd1e5b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions OutlookCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from msal import PublicClientApplication
import IndividualCalendar
import GenerateReport

import sys

def process_args():
parser = argparse.ArgumentParser(
prog = 'vacation_calendar_sync',
Expand Down Expand Up @@ -138,6 +139,9 @@ def main(configs):
time.sleep(configs['update_interval'])

if __name__ == '__main__':
# Redirects stdout stderr to out.log
sys.stderr = open('out.log', 'w')

configs = utils.get_configurations()

formater = logging.Formatter('%(name)s:%(asctime)s:%(filename)s:%(levelname)s:%(message)s')
Expand All @@ -153,7 +157,7 @@ def main(configs):
logger.setLevel(logging.DEBUG)
logger.addHandler(rotate_file_handler_info)

stream_handler = logging.StreamHandler()
stream_handler = logging.StreamHandler(sys.stderr)
stream_handler.setLevel(logging.DEBUG)
stream_handler.setFormatter(fmt=logging.Formatter('%(name)s:%(asctime)s:%(filename)s:%(levelname)s:%(message)s'))
logger.addHandler(stream_handler)
Expand Down

0 comments on commit afd1e5b

Please sign in to comment.