Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Nov 12, 2023
1 parent c7317a4 commit 8149fb6
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/sdsstools/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import copy
import datetime
import json
import logging
import os
import pathlib
Expand Down Expand Up @@ -419,13 +418,7 @@ def start_file_logger(
if at_time and isinstance(at_time, str):
at_time = datetime.time.fromisoformat(at_time)

# if rotating:
# self.fh = TimedRotatingFileHandler(
# str(log_file_path), when=when, utc=utc, atTime=at_time
# )
# self.fh.suffix = SUFFIX # type: ignore
# else:
# self.fh = logging.FileHandler(str(log_file_path), mode=mode)
# get the file handler
self.fh = self._set_file_handler(log_file_path, SUFFIX, mode=mode,
rotating=rotating, when=when, utc=utc,
at_time=at_time)
Expand All @@ -435,15 +428,6 @@ def start_file_logger(
rotating=rotating, when=when, utc=utc,
at_time=at_time)

# if with_json:
# if rotating:
# self.jh = TimedRotatingFileHandler(
# str(log_file_path), when=when, utc=utc, atTime=at_time
# )
# self.jh.suffix = SUFFIX # type: ignore
# else:
# self.jh = logging.FileHandler(str(log_file_path), mode=mode)

except (IOError, OSError, ValueError) as ee:
warnings.warn(
"log file {0!r} could not be opened for "
Expand All @@ -452,7 +436,7 @@ def start_file_logger(
)

else:
#json_fmt = json.dumps('%(timestamp)s %(level)s %(name)s %(message)s')
# set the correct file or json formatter
formatter = CustomJsonFormatter() if as_json else FileFormatter()
self.fh.setFormatter(formatter)
self.addHandler(self.fh)
Expand All @@ -463,6 +447,7 @@ def start_file_logger(

self.log_filename = log_file_path

# set json file handler and formatter
if with_json and self.jh:
self.jh.setFormatter(CustomJsonFormatter())
self.addHandler(self.jh)
Expand Down

0 comments on commit 8149fb6

Please sign in to comment.