From 3a784e338224a0bad298056f0a5476b280468f11 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 3 Feb 2015 10:07:37 +0800 Subject: [PATCH] doc/writing_a_driver: use logging.getLogger --- doc/manual/writing_a_driver.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/manual/writing_a_driver.rst b/doc/manual/writing_a_driver.rst index 4fe512f0e..a709908aa 100644 --- a/doc/manual/writing_a_driver.rst +++ b/doc/manual/writing_a_driver.rst @@ -121,9 +121,14 @@ The program below exemplifies how to use logging: :: import argparse import logging + from artiq.tools import verbosity_args, init_logger + # get a logger that prints the module name + logger = logging.getLogger(__name__) + + def get_argparser(): parser = argparse.ArgumentParser(description="Logging example") parser.add_argument("--someargument", @@ -137,11 +142,11 @@ The program below exemplifies how to use logging: :: args = get_argparser().parse_args() init_logger(args) # This initializes logging system log level according to -v/-q args - logging.debug("this is a debug message") - logging.info("this is an info message") - logging.warning("this is a warning message") - logging.error("this is an error message") - logging.critical("this is a critical message") + logger.debug("this is a debug message") + logger.info("this is an info message") + logger.warning("this is a warning message") + logger.error("this is an error message") + logger.critical("this is a critical message") if __name__ == "__main__": main()