Skip to content

Commit dcba89d

Browse files
committed
Some docstring tweaks
1 parent 27959ef commit dcba89d

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

stackify/__init__.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,28 @@ def emit(self, record):
4343

4444

4545
def 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

7595
def 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

86107
def 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

99118
def 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

Comments
 (0)