Skip to content

Commit e929e17

Browse files
committed
Reformat doc strings
1 parent f708a32 commit e929e17

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

adafruit_logger.py

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@
4242
"""
4343
#pylint:disable=redefined-outer-name,consider-using-enumerate,no-self-use
4444

45-
# imports
45+
import time
4646

4747
__version__ = "0.0.0-auto.0"
4848
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Logger.git"
4949

50-
import time
5150

5251
LEVELS = [(00, 'NOTSET'),
5352
(10, 'DEBUG'),
@@ -61,7 +60,9 @@
6160

6261
def level_for(value):
6362
"""Convert a numberic level to the most appropriate name.
64-
value -- a numeric level
63+
64+
:param value: a numeric level
65+
6566
"""
6667
for i in range(len(LEVELS)):
6768
if value < LEVELS[i][0]:
@@ -73,8 +74,10 @@ class LoggingHandler(object):
7374

7475
def format(self, level, msg):
7576
"""Generate a timestamped message.
76-
level -- the logging level
77-
msg -- the message to log
77+
78+
:param level: the logging level
79+
:param msg: the message to log
80+
7881
"""
7982
now = time.localtime()
8083
time_vals = (now.tm_year, now.tm_mon, now.tm_mday,
@@ -94,8 +97,10 @@ class PrintHandler(LoggingHandler):
9497

9598
def emit(self, level, msg):
9699
"""Send a message to teh console.
97-
level -- the logging level
98-
msg -- the message to log
100+
101+
:param level: the logging level
102+
:param msg: the message to log
103+
99104
"""
100105
print(self.format(level, msg))
101106

@@ -108,7 +113,9 @@ class Logger(object):
108113

109114
def __init__(self, handler=None):
110115
"""Create an instance.
111-
handler -- what to use to output messages. Defaults to a PrintHandler.
116+
117+
:param handler: what to use to output messages. Defaults to a PrintHandler.
118+
112119
"""
113120
self._level = NOTSET
114121
if handler is None:
@@ -118,54 +125,65 @@ def __init__(self, handler=None):
118125

119126
@property
120127
def level(self):
121-
"""Get the level."""
128+
"""The level."""
122129
return self._level
123130

124131
@level.setter
125132
def level(self, value):
126-
"""Set the level."""
127133
self._level = value
128134

129135
def log(self, level, format_string, *args):
130136
"""Log a message.
131-
level -- the priority level at which to log
132-
format_string -- the core mesage string with embedded formatting directives
133-
args -- arguments format_string.format(), can be empty
137+
138+
:param level: the priority level at which to log
139+
:param format_string: the core message string with embedded formatting directives
140+
:param args: arguments to ``format_string.format()``, can be empty
141+
134142
"""
135143
if self._level != NOTSET and level >= self._level:
136144
self._handler.emit(level, format_string.format(*args))
137145

138146
def debug(self, format_string, *args):
139147
"""Log a debug message.
140-
format_string -- the core mesage string with embedded formatting directives
141-
args -- arguments format_string.format(), can be empty
148+
149+
:param format_string: the core message string with embedded formatting directives
150+
:param args: arguments to ``format_string.format()``, can be empty
151+
142152
"""
143153
self.log(DEBUG, format_string, *args)
144154

145155
def info(self, format_string, *args):
146156
"""Log a info message.
147-
format_string -- the core mesage string with embedded formatting directives
148-
args -- arguments format_string.format(), can be empty
157+
158+
:param format_string: the core message string with embedded formatting directives
159+
:param args: arguments to ``format_string.format()``, can be empty
160+
149161
"""
150162
self.log(INFO, format_string, *args)
151163

152164
def warning(self, format_string, *args):
153165
"""Log a warning message.
154-
format_string -- the core mesage string with embedded formatting directives
155-
args -- arguments format_string.format(), can be empty
166+
167+
:param format_string: the core message string with embedded formatting directives
168+
:param args: arguments to ``format_string.format()``, can be empty
169+
156170
"""
157171
self.log(WARNING, format_string, *args)
158172

159173
def error(self, format_string, *args):
160174
"""Log a error message.
161-
format_string -- the core mesage string with embedded formatting directives
162-
args -- arguments format_string.format(), can be empty
175+
176+
:param format_string: the core message string with embedded formatting directives
177+
:param args: arguments to ``format_string.format()``, can be empty
178+
163179
"""
164180
self.log(ERROR, format_string, *args)
165181

166182
def critical(self, format_string, *args):
167183
"""Log a critical message.
168-
format_string -- the core mesage string with embedded formatting directives
169-
args -- arguments format_string.format(), can be empty
184+
185+
:param format_string: the core message string with embedded formatting directives
186+
:param args: arguments to ``format_string.format()``, can be empty
187+
170188
"""
171189
self.log(CRITICAL, format_string, *args)

0 commit comments

Comments
 (0)