CerebroToolboxPrint

Print

Last updated:

Toolbox: Print

The logger provides print methods for formatted output (if using a logger that supports it, like Pail).

Basic Printing

execute: ({ logger }) => {
    logger.info("Info message");
    logger.error("Error message");
    logger.warn("Warning message");
    logger.debug("Debug message");
};

Custom Print Methods

Some loggers (like Pail) provide additional print methods:

execute: ({ logger }) => {
    // If using Pail logger
    if (logger.success) {
        logger.success("Operation successful!");
    }

    if (logger.table) {
        logger.table([
            { name: "Alice", age: 30 },
            { name: "Bob", age: 25 },
        ]);
    }
};

Raw Output

Some loggers support raw output:

execute: ({ logger }) => {
    if (logger.raw) {
        logger.raw("Raw output without formatting");
    }
};

Using Pail Logger

For enhanced printing capabilities, use the Pail logger:

import { pail } from "@visulima/pail";

const cli = new Cerebro("my-app", {
    logger: pail({
        // Pail configuration
    }),
});

Pail provides:

  • Colored output
  • Tables
  • Success/error formatting
  • Progress bars
  • And more

See Pail documentation for details.

Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues