2023-11-06 00:31:03 +08:00
|
|
|
# -------------------------------
|
|
|
|
# Difficult Rocket
|
|
|
|
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
|
|
|
# All rights reserved
|
|
|
|
# -------------------------------
|
|
|
|
|
|
|
|
from lib_not_dr.logger.logger import Logger
|
|
|
|
|
2023-11-28 23:19:18 +08:00
|
|
|
import logging
|
|
|
|
|
|
|
|
|
2023-12-03 16:36:01 +08:00
|
|
|
def logging_logger() -> None:
|
|
|
|
logger = logging.getLogger("test")
|
2023-11-29 00:31:52 +08:00
|
|
|
logger.level = logging.INFO
|
2023-11-28 23:19:18 +08:00
|
|
|
|
2023-12-03 16:36:01 +08:00
|
|
|
logger.info("Hello World!")
|
|
|
|
logger.debug("Hello World!")
|
|
|
|
logger.warning("warnnnnnnn")
|
|
|
|
logger.error("Hello World!")
|
|
|
|
logger.fatal("good bye world") # critical
|
2023-11-28 23:19:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
def lndl_logger() -> None:
|
2023-12-03 16:36:01 +08:00
|
|
|
logger = Logger.get_logger_by_name("test")
|
2023-11-29 00:31:52 +08:00
|
|
|
logger.global_level = 20
|
2023-11-06 00:31:03 +08:00
|
|
|
|
2023-12-03 16:36:01 +08:00
|
|
|
logger.info("Hello World!")
|
|
|
|
logger.fine("Hello World!")
|
|
|
|
logger.debug("Hello World!")
|
|
|
|
logger.trace("Hello tracing!")
|
|
|
|
logger.warn("warnnnnnnn")
|
|
|
|
logger.error("Hello World!")
|
|
|
|
logger.fatal("good bye world")
|
2023-11-28 23:19:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2023-12-03 16:36:01 +08:00
|
|
|
logger = Logger.get_logger_by_name("test")
|
2023-11-28 23:19:18 +08:00
|
|
|
logger.global_level = 0
|
2023-11-06 00:31:03 +08:00
|
|
|
|
2023-12-03 16:36:01 +08:00
|
|
|
logger.info("Hello World!")
|
|
|
|
logger.fine("Hello World!")
|
|
|
|
logger.debug("Hello World!")
|
|
|
|
logger.trace("Hello tracing!")
|
|
|
|
logger.warn("warnnnnnnn")
|
|
|
|
logger.error("Hello World!")
|
|
|
|
logger.fatal("good bye world")
|
2023-11-06 21:30:46 +08:00
|
|
|
|
2023-12-03 16:36:01 +08:00
|
|
|
logger.info("this message if from tag", tag="test")
|
|
|
|
logger.debug("this debug log if from admin", tag="admin")
|
|
|
|
logger.debug("and this message ends with none", end=" ")
|
|
|
|
logger.trace("so this message will be in the same line", tag="same line!")
|
|
|
|
logger.info("so just info some stuff")
|
2023-11-07 01:03:07 +08:00
|
|
|
|
2023-11-12 22:14:44 +08:00
|
|
|
|
2023-12-03 16:36:01 +08:00
|
|
|
if __name__ == "__main__":
|
2023-11-29 00:31:52 +08:00
|
|
|
main()
|
2023-11-28 23:19:18 +08:00
|
|
|
lndl_logger()
|
|
|
|
logging_logger()
|