Skip to content

Commit

Permalink
Improve perfs by avoiding date fetching when not needed (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Apr 28, 2022
1 parent c734ac3 commit a1989d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions loguru/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ def modules_depth(x):
self._core.enabled = enabled

@staticmethod
def parse(file, pattern, *, cast={}, chunk=2 ** 16):
def parse(file, pattern, *, cast={}, chunk=2**16):
"""Parse raw logs and extract each entry as a |dict|.
The logging format has to be specified as the regex ``pattern``, it will then be
Expand Down Expand Up @@ -1882,8 +1882,6 @@ def _log(self, level_id, static_level_no, from_decorator, options, message, args
return
enabled[name] = True

current_datetime = aware_now()

if level_id is None:
level_icon = " "
level_no = static_level_no
Expand All @@ -1897,6 +1895,8 @@ def _log(self, level_id, static_level_no, from_decorator, options, message, args
if level_no < core.min_level:
return

current_datetime = aware_now()

code = frame.f_code
file_path = code.co_filename
file_name = basename(file_path)
Expand Down

0 comments on commit a1989d3

Please sign in to comment.