0.2.0-beta.2 • Published 2 years ago

modern-api.styledlog v0.2.0-beta.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

modern-api.styledlog

Log text in custom css style based on Web Console API.

Install

$ npm i modern-api.styledlog

Usage

log text in custom css style

import { log, styled } from 'modern-api.styledlog'

const styledText1 = styled({color: 'red', 'background': 'green'})
const styledText2 = styled({color: 'green', 'background': 'red'})

log(styledText1('hello'), styledText2('world'))

API

/**
 * create log style
 *
 * @param {Record<string, string>} styles - custom text style
 * @returns {(text: any) => string[]} - callback to format text
 */
declare const styled: (styles: Record<string, string>) => (text: any) => string[];
/**
 * output formatted texts via `console.log`
 *
 * @param {...(string[])} texts - formatted text to output
 * @returns {void}
 */
declare const log: (...texts: (string[])[]) => void;
/**
 * output formatted texts via `console.warn`
 *
 * @param {...(string[])} texts - formatted text to output
 * @returns {void}
 */
declare const warn: (...texts: (string[])[]) => void;
/**
 * output formatted texts via `console.error`
 *
 * @param {...(string[])} texts - formatted text to output
 * @returns {void}
 */
declare const error: (...texts: (string[])[]) => void;
/**
 * output formatted texts via `console.debug`
 *
 * @param {...(string[])} texts - formatted text to output
 * @returns {void}
 */
declare const debug: (...texts: (string[])[]) => void;