Giter Club home page Giter Club logo

console-pretty-log's Introduction

Console Pretty Print

PHP from Packagist Latest Version Software License Build Quality Score Total Downloads

Simple and customizable console log output for CLI apps.

Highlights

  • Simple installation (Instalação simples)
  • Very easy to customize text output (Muito fácil de customizar a saída de texto)
  • Composer ready and PSR-12 compliant (Pronto para o composer e compatível com PSR-12)

Installation

Uploader is available via Composer:

"curruwilla/console-pretty-log": "^1.0"

or run

composer require curruwilla/console-pretty-log

Documentation

Check the example file.

If you are defining the size of columns, when using textInitial be sure to enter the size as well.

Example:

use ConsolePrettyLog\Background;
use ConsolePrettyLog\Color;
use ConsolePrettyLog\Font;
use ConsolePrettyLog\Line;

$line = new Line();
$line->columnsSize([15, 75, 10]); // <-- Use to keep information aligned
//$line->separator('-'); <-- Default value: '|'
//$line->paddingCharacter(' '); <-- Default value: '.'
//$line->enableDate(false); <-- Default value: true
//$line->dateFormat("d/m/Y H:i"); <-- Default value: 'Y-m-d H:i:s'
//$line->textInitial('LOG', [Color::RED, Font::BOLD]); <-- Include text at the beginning of every line
//$line->textInitial('IMPORTANT', [Font::BOLD]); <-- Include text at the beginning of every line

$line
    ->text('Account 1', [Font::BOLD, Font::ITALIC])
    ->text('Delivery made successfully', [Color::WHITE])
    ->text('Success', [Color::GREEN])
    ->print();

$line
    ->text('Account 2', [Font::BOLD])
    ->text('Opps, something went wrong with the delivery, please see the log', [Color::WHITE])
    ->text('Error', [Background::RED])
    ->print();

$line
    ->text('Account 3', [Font::BOLD])
    ->text('Payment made successfully', [Color::WHITE, Font::ITALIC])
    ->text('SUCCESS', [Background::GREEN])
    ->print();

$line
    ->text('Account 1', [Font::BOLD])
    ->text('Payment made successfully', [Color::WHITE])
    ->text('INFO', [Background::BLUE])
    ->print();

Result in CLI:

example.png

Enums Options:

options_enums.png

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

console-pretty-log's People

Contributors

curruwilla avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.