API reference#
earthcarekit.utils.logging
Logging utilities.
Notes#
This module does not depend on other internal modules.
LOG_FORMAT_DEV
module-attribute
#
LOG_FORMAT_DEV: Final[str] = (
"%(asctime)s [%(levelname).1s] %(name)s.%(funcName)s:%(lineno)d - %(message)s"
)
Detailed log format intended for development and debugging.
LOG_FORMAT_JSON
module-attribute
#
LOG_FORMAT_JSON: Final[str] = (
'{ "time": "%(asctime)s", "level": "%(levelname).1s", "module": "%(name)s", "message": "%(message)s" }'
)
JSON log format intended for structured log processing.
LOG_FORMAT_LINE
module-attribute
#
Detailed log format including source file and line number.
LOG_FORMAT_USER
module-attribute
#
Concise log format intended for end users.
set
#
set(level: int | str = INFO, format: str = LOG_FORMAT_USER) -> None
Configure logging and supress versboe third-party output.
Source code in earthcarekit/utils/logging.py
silence_logger
#
Temporarily raise the logging level of a given logger.
Examples:
from earthcarekit.utils.logging import silence_logger
logger = logging.getLogger()
logger.info("This message is logged.")
with silence_logger(logger):
logger.info("This message is NOT logged!")
logger.info("This message is logged again.")