Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit ccc0f48

Browse files
authored
Merge pull request #48 from IdentityPython/time_utils_err
logging.error in time_util.py
2 parents 0fe4952 + bb9bfc7 commit ccc0f48

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/oidcmsg/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def configure_logging(debug: Optional[bool] = False,
3838
config_source = 'dictionary'
3939
elif filename is not None and os.path.exists(filename):
4040
with open(filename, "rt") as file:
41-
config_dict = yaml.load(file)
41+
config_dict = yaml.safe_load(file)
4242
config_source = 'file'
4343
else:
4444
config_dict = LOGGING_DEFAULT

src/oidcmsg/time_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"""
2121

2222
import calendar
23+
import logging
2324
import re
2425
import sys
2526
import time
@@ -30,6 +31,8 @@
3031
TIME_FORMAT_WITH_FRAGMENT = re.compile("^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})\.\d*Z$")
3132

3233

34+
logger = logging.getLogger(__name__)
35+
3336
class TimeUtilError(Exception):
3437
pass
3538

@@ -287,7 +290,7 @@ def str_to_time(timestr, time_format=TIME_FORMAT):
287290
try:
288291
elem = TIME_FORMAT_WITH_FRAGMENT.match(timestr)
289292
except Exception as exc:
290-
print >>sys.stderr, "Exception: %s on %s" % (exc, timestr)
293+
logger.error("Exception: %s on %s" % (exc, timestr))
291294
raise
292295
then = time.strptime(elem.groups()[0] + "Z", TIME_FORMAT)
293296

0 commit comments

Comments
 (0)