@@ -43,8 +43,28 @@ def emit(self, record):
4343
4444
4545def getLogger (name = None , auto_shutdown = True , basic_config = True , ** kwargs ):
46- '''
47- Get a logger and attach a StackifyHandler if needed.
46+ '''Get a logger and attach a StackifyHandler if needed.
47+
48+ You can pass this function keyword arguments for Stackify configuration.
49+ If they are omitted you can specify them through environment variables:
50+ * STACKIFY_API_KEY
51+ * STACKIFY_APPLICATION
52+ * STACKIFY_ENVIRONMENT
53+ * STACKIFY_API_URL
54+
55+ Args:
56+ name: The name of the logger (or None to automatically make one)
57+ auto_shutdown: Register an atexit hook to shut down logging
58+ basic_config: Set up with logging.basicConfig() for regular logging
59+
60+ Optional Args:
61+ api_key: Your Stackify API key
62+ application: The name of your Stackify application
63+ environment: The Stackfiy environment to log to
64+ api_url: An optional API url if required
65+
66+ Returns:
67+ A logger instance with Stackify handler and listener attached.
4868 '''
4969 if basic_config :
5070 logging .basicConfig ()
@@ -73,7 +93,8 @@ def getLogger(name=None, auto_shutdown=True, basic_config=True, **kwargs):
7393
7494
7595def stopLogging (logger ):
76- '''
96+ '''Stop logging on the Stackify handler.
97+
7798 Shut down the StackifyHandler on a given logger. This will block
7899 and wait for the queue to finish uploading.
79100 '''
@@ -84,9 +105,7 @@ def stopLogging(logger):
84105
85106
86107def getCallerName (levels = 1 ):
87- '''
88- Gets the name of the module calling this function
89- '''
108+ '''Gets the name of the module calling this function'''
90109 try :
91110 frame = inspect .stack ()[levels ]
92111 module = inspect .getmodule (frame [0 ])
@@ -97,7 +116,5 @@ def getCallerName(levels=1):
97116
98117
99118def getHandlers (logger ):
100- '''
101- Return the StackifyHandlers on a given logger
102- '''
119+ '''Return the StackifyHandlers on a given logger'''
103120 return [x for x in logger .handlers if isinstance (x , StackifyHandler )]
0 commit comments