|
26 | 26 | _logger = logging.getLogger(__name__) |
27 | 27 |
|
28 | 28 | IS_PYPY = hasattr(sys, "pypy_version_info") |
29 | | -LOGURU_VERSION = get_package_version_tuple("loguru") |
30 | 29 | LOGURU_FILTERED_RECORD_ATTRS = {"extra", "message", "time", "level", "_nr_original_message", "record"} |
31 | 30 | ALLOWED_LOGURU_OPTIONS_LENGTHS = frozenset((8, 9)) |
32 | 31 |
|
@@ -69,7 +68,7 @@ def _nr_log_forwarder(message_instance): |
69 | 68 | try: |
70 | 69 | time = record.get("time", None) |
71 | 70 | if time: |
72 | | - time = int(time.timestamp()*1000) |
| 71 | + time = int(time.timestamp() * 1000) |
73 | 72 | record_log_event(message, level_name, time, attributes=attrs) |
74 | 73 | except Exception: |
75 | 74 | pass |
@@ -116,18 +115,15 @@ def _nr_log_patcher(record): |
116 | 115 | record["_nr_original_message"] = message = record["message"] |
117 | 116 | record["message"] = add_nr_linking_metadata(message) |
118 | 117 |
|
119 | | - if LOGURU_VERSION > (0, 6, 0): |
120 | | - if original_patcher is not None: |
121 | | - patchers = [p for p in original_patcher] # Consumer iterable into list so we can modify |
122 | | - # Wipe out reference so patchers aren't called twice, as the framework will handle calling other patchers. |
123 | | - original_patcher = None |
124 | | - else: |
125 | | - patchers = [] |
126 | | - |
127 | | - patchers.append(_nr_log_patcher) |
128 | | - return patchers |
| 118 | + if original_patcher is not None: |
| 119 | + patchers = [p for p in original_patcher] # Consumer iterable into list so we can modify |
| 120 | + # Wipe out reference so patchers aren't called twice, as the framework will handle calling other patchers. |
| 121 | + original_patcher = None |
129 | 122 | else: |
130 | | - return _nr_log_patcher |
| 123 | + patchers = [] |
| 124 | + |
| 125 | + patchers.append(_nr_log_patcher) |
| 126 | + return patchers |
131 | 127 |
|
132 | 128 |
|
133 | 129 | def wrap_Logger_init(wrapped, instance, args, kwargs): |
|
0 commit comments