Skip to content

Commit

Permalink
Uncomment and fix logger lines in ics writer (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
mobeigi authored Nov 11, 2020
1 parent 5f6e313 commit de0de0d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ics_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import calendar
from logger import Logger

from __init__ import __version__, __status__, __website__

""" Write Birthdays to an ICS file """
class ICSWriter:

def __init__(self, birthdays):
self.logger = Logger('fb2cal').getLogger()
self.birthdays = birthdays

def generate(self):
Expand Down Expand Up @@ -54,13 +56,13 @@ def generate(self):
def write(self, ics_file_path):
# Remove blank lines
ics_str = ''.join([line.rstrip('\n') for line in self.birthday_calendar])
# logger.debug(f'ics_str: {ics_str}')
self.logger.debug(f'ics_str: {ics_str}')

# logger.info(f'Saving ICS file to local file system...')
self.logger.info(f'Saving ICS file to local file system...')

if not os.path.exists(os.path.dirname(ics_file_path)):
os.makedirs(os.path.dirname(ics_file_path), exist_ok=True)

with open(ics_file_path, mode='w', encoding="UTF-8") as ics_file:
ics_file.write(ics_str)
#logger.info(f'Successfully saved ICS file to {os.path.abspath(ics_file_path)}')
self.logger.info(f'Successfully saved ICS file to {os.path.abspath(ics_file_path)}')

0 comments on commit de0de0d

Please sign in to comment.