Skip to content

Commit 3a784e3

Browse files
committedFeb 3, 2015
doc/writing_a_driver: use logging.getLogger
1 parent c259c4f commit 3a784e3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
 

Diff for: ‎doc/manual/writing_a_driver.rst

+10-5
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,14 @@ The program below exemplifies how to use logging: ::
121121

122122
import argparse
123123
import logging
124+
124125
from artiq.tools import verbosity_args, init_logger
125126

126127

128+
# get a logger that prints the module name
129+
logger = logging.getLogger(__name__)
130+
131+
127132
def get_argparser():
128133
parser = argparse.ArgumentParser(description="Logging example")
129134
parser.add_argument("--someargument",
@@ -137,11 +142,11 @@ The program below exemplifies how to use logging: ::
137142
args = get_argparser().parse_args()
138143
init_logger(args) # This initializes logging system log level according to -v/-q args
139144

140-
logging.debug("this is a debug message")
141-
logging.info("this is an info message")
142-
logging.warning("this is a warning message")
143-
logging.error("this is an error message")
144-
logging.critical("this is a critical message")
145+
logger.debug("this is a debug message")
146+
logger.info("this is an info message")
147+
logger.warning("this is a warning message")
148+
logger.error("this is an error message")
149+
logger.critical("this is a critical message")
145150

146151
if __name__ == "__main__":
147152
main()

0 commit comments

Comments
 (0)
Please sign in to comment.