@osaedasia/scribe
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Scribe

A simple library to log colorized messages in the console.

The library is available through the following package managers:

Table of Contents

Features

  • Colorized Console Logging: Easily log messages with embedded color codes.
  • Predefined Color Palette: Use a wide range of predefined colors.
  • Template Logging: Log multiple messages with specific color settings.
  • Lightweight and Easy to Use: Minimal setup with straightforward API.

Usage

Basic Logging

Scribe provides straightforward methods to log messages with or without colors.

import { Scribe, Color } from "@osaedasia/scribe";

// Simple log without color
Scribe.log("This is a plain message.");

// Log with color using delimiters
Scribe.log("This is a @%-colored-%@ message.", [Color.Green]);

Predefined Log Levels

Scribe offers predefined methods for common log levels, each applying specific colors to enhance readability.

Warning

Logs a warning message in bright yellow.

import { Scribe } from "@osaedasia/scribe";

Scribe.warning("This is a warning message.");

Error

Logs an error message in bright red.

import { Scribe } from "@osaedasia/scribe";

Scribe.error("This is an error message.");

Success

Logs a success message in bright green.

import { Scribe } from "@osaedasia/scribe";

Scribe.success("This is a success message.");

Info

Logs an informational message in light gray.

import { Scribe } from "@osaedasia/scribe";

Scribe.info("This is an informational message.");

Template Logging

Scribe.template allows logging multiple messages with individual color settings in a single call.

import { Scribe, Color } from "@osaedasia/scribe";

Scribe.template([
    { message: " --- Operation results" },
    { message: "| - Success: @%-13-%@.", colors: [Color.BrightGreen] },
    { message: "| - Warning: @%-Low disk space-%@.", colors: [Color.BrightYellow] },
    { message: "| - Error: @%-Connection failed-%@.", colors: [Color.BrightRed] },
    { message: " ---" }
]);

// Output:
//  --- Operation results
// | - Success: [green 13].
// | - Warning: [yellow Low disk space].
// | - Error: [red Connection failed].
//  ---

Reporting Issues

If you encounter any issues while using the library, feel free to report them by creating an issue on the GitLab repository. Since I’m the sole maintainer, please provide as much detail as possible to help me resolve the issue efficiently. Make sure to include:

  • Clear description of the problem.
  • Steps to reproduce the issue.
  • library version.
  • Relevant information such as:
    • Stack trace.
    • Environment details (e.g., operating system, Node.js version, Deno version, etc.).
    • Code snippets where the issue occurs.

Your detailed feedback is crucial in improving the library for everyone.

LICENCE

MIT License

Copyright (c) 2024 Osaedasia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

/@osaedasia/scribe/

    Package Sidebar

    Install

    npm i @osaedasia/scribe

    Weekly Downloads

    1

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    17.4 kB

    Total Files

    9

    Last publish

    Collaborators

    • osaedasia