Skip to content

Commit 6c087b8

Browse files
author
constient-altrova
committed
🔄 synced local 'logfire/' with remote 'logfire/'
1 parent e71ccce commit 6c087b8

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

‎logfire/handler.py‎

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .uploader import Uploader
99
from .frame import create_frame
1010

11-
DEFAULT_HOST = 'https://in.logfire.sh'
11+
DEFAULT_HOST = "https://in.logfire.ai"
1212
DEFAULT_BUFFER_CAPACITY = 1000
1313
DEFAULT_FLUSH_INTERVAL = 1
1414
DEFAULT_RAISE_EXCEPTIONS = False
@@ -17,16 +17,18 @@
1717

1818

1919
class LogfireHandler(logging.Handler):
20-
def __init__(self,
21-
source_token,
22-
host=DEFAULT_HOST,
23-
buffer_capacity=DEFAULT_BUFFER_CAPACITY,
24-
flush_interval=DEFAULT_FLUSH_INTERVAL,
25-
raise_exceptions=DEFAULT_RAISE_EXCEPTIONS,
26-
drop_extra_events=DEFAULT_DROP_EXTRA_EVENTS,
27-
include_extra_attributes=DEFAULT_INCLUDE_EXTRA_ATTRIBUTES,
28-
context=DEFAULT_CONTEXT,
29-
level=logging.NOTSET):
20+
def __init__(
21+
self,
22+
source_token,
23+
host=DEFAULT_HOST,
24+
buffer_capacity=DEFAULT_BUFFER_CAPACITY,
25+
flush_interval=DEFAULT_FLUSH_INTERVAL,
26+
raise_exceptions=DEFAULT_RAISE_EXCEPTIONS,
27+
drop_extra_events=DEFAULT_DROP_EXTRA_EVENTS,
28+
include_extra_attributes=DEFAULT_INCLUDE_EXTRA_ATTRIBUTES,
29+
context=DEFAULT_CONTEXT,
30+
level=logging.NOTSET,
31+
):
3032
super(LogfireHandler, self).__init__(level=level)
3133
self.source_token = source_token
3234
self.host = host
@@ -40,10 +42,7 @@ def __init__(self,
4042
self.raise_exceptions = raise_exceptions
4143
self.dropcount = 0
4244
self.flush_thread = FlushWorker(
43-
self.uploader,
44-
self.pipe,
45-
self.buffer_capacity,
46-
self.flush_interval
45+
self.uploader, self.pipe, self.buffer_capacity, self.flush_interval
4746
)
4847
if self._is_main_process():
4948
self.flush_thread.start()
@@ -56,7 +55,12 @@ def emit(self, record):
5655
if self._is_main_process() and not self.flush_thread.is_alive():
5756
self.flush_thread.start()
5857
message = self.format(record)
59-
frame = create_frame(record, message, self.context, include_extra_attributes=self.include_extra_attributes)
58+
frame = create_frame(
59+
record,
60+
message,
61+
self.context,
62+
include_extra_attributes=self.include_extra_attributes,
63+
)
6064
try:
6165
self.pipe.put(frame, block=(not self.drop_extra_events))
6266
except queue.Full:
@@ -66,4 +70,4 @@ def emit(self, record):
6670
pass
6771
except Exception as e:
6872
if self.raise_exceptions:
69-
raise e
73+
raise e

0 commit comments

Comments
 (0)