Skip to content

Commit

Permalink
doc/writing_a_driver: use logging.getLogger
Browse files Browse the repository at this point in the history
sbourdeauducq committed Feb 3, 2015
1 parent c259c4f commit 3a784e3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions doc/manual/writing_a_driver.rst
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 3a784e3

Please sign in to comment.