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 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:

# example_project/tasks/task_with_logging.py

import logging
import prism.task

logger = logging.getLogger("prism")

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

You can configure the logging level and the location of the outputted .log file when instantiating your PrismProject.

Last updated