Simple test

Ensure your device works with this simple test.

examples/logging_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# pylint:disable=undefined-variable,wildcard-import,no-name-in-module
# pylint:disable=no-member,invalid-name

"""Briefly exercise the logger and null logger."""

import adafruit_logging as logging

# This should produce an error output

logger = logging.getLogger("test")

logger.setLevel(logging.ERROR)
logger.info("Info message")
logger.error("Error message")

# This should produce no output

null_logger = logging.getLogger(None)

null_logger.setLevel(logging.ERROR)
null_logger.info("Info message")
null_logger.error("Error message")

# This should produce no output

null_logger = logging.getLogger("")

null_logger.setLevel(logging.ERROR)
null_logger.info("Info message")
null_logger.error("Error message")