Logging

Overview

Prism operates under the philosophy that logs should contain useful, diagnostic information about the project without overwhelming the reader.

Prism uses and extends Python’s builtin logging module to perform system logging. Whenever you run a project, Prism automatically logs events for parsing the configuration files, compiling the tasks and creating the DAG, and executing the tasks, etc. These events are color-coded to enhance readability. No configuration is needed to enable Prism logging.

Customizing logs

The PRISM_LOGGER logger is the entry point into Prism's logging system. If you want to log custom events in your project, you can do so with this variable:

# tasks/task_with_logging.py

import prism_project
from prism_project import PRISM_LOGGER
import prism.task

class TaskWithLogging(prism.task.PrismTask):
    
    def run(self, tasks, hooks):
        PRISM_LOGGER.info("This is an example log message!")
        return ...

Logs are automatically saved to logs.log in the base project folder.

Note that you can specify the default log level to show using the command-line interface. See the CLI section for more information.

Last updated