11"""
22Stackify Python API
33"""
4-
4+ __all__ = ( "VERSION" )
55__version__ = '0.0.1'
66
7-
8- API_URL = 'https://api.stackify.com'
9-
10- READ_TIMEOUT = 5000
11-
12- MAX_BATCH = 100
13-
14- QUEUE_SIZE = 1000
15-
167import logging
178import inspect
189import atexit
1910
20- DEFAULT_LEVEL = logging .ERROR
21-
22- LOGGING_LEVELS = {
23- logging .CRITICAL : 'CRITICAL' ,
24- logging .ERROR : 'ERROR' ,
25- logging .WARNING : 'WARNING' ,
26- logging .INFO : 'INFO' ,
27- logging .DEBUG : 'DEBUG' ,
28- logging .NOTSET : 'NOTSET'
29- }
11+ from stackify .application import ApiConfiguration # noqa
12+ from stackify .constants import DEFAULT_LEVEL
13+ from stackify .handler import StackifyHandler
3014
3115
3216class NullHandler (logging .Handler ):
3317 def emit (self , record ):
3418 pass
3519
36- logging .getLogger (__name__ ).addHandler (NullHandler ())
37-
3820
39- from stackify .application import ApiConfiguration
40- from stackify .http import HTTPClient
41-
42- from stackify .handler import StackifyHandler
21+ logging .getLogger (__name__ ).addHandler (NullHandler ())
4322
4423
4524def getLogger (name = None , auto_shutdown = True , basic_config = True , ** kwargs ):
@@ -77,8 +56,6 @@ def getLogger(name=None, auto_shutdown=True, basic_config=True, **kwargs):
7756 if not [isinstance (x , StackifyHandler ) for x in logger .handlers ]:
7857 internal_logger = logging .getLogger (__name__ )
7958 internal_logger .debug ('Creating handler for logger %s' , name )
80- handler = StackifyHandler (** kwargs )
81- logger .addHandler (handler )
8259
8360 if auto_shutdown :
8461 internal_logger .debug ('Registering atexit callback' )
@@ -87,6 +64,9 @@ def getLogger(name=None, auto_shutdown=True, basic_config=True, **kwargs):
8764 if logger .getEffectiveLevel () == logging .NOTSET :
8865 logger .setLevel (DEFAULT_LEVEL )
8966
67+ handler = StackifyHandler (ensure_at_exit = not auto_shutdown , ** kwargs )
68+ logger .addHandler (handler )
69+
9070 handler .listener .start ()
9171
9272 return logger
0 commit comments