fail-whale
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

fail-whale

▄████████████▄▐█▄▄▄▄█▌
█████▌▄▌▄▐▐▌██▌▀▀██▀▀
███▄█▌▄▌▄▐▐▌▀██▄▄█▌
▄▄▄▄█████████████

Easily print a fail whale

import { failWhale } from 'fail-whale';

// When something bad happens
failWhale("Something went wrong :(")

/* 
Prints to console.error:
▄████████████▄▐█▄▄▄▄█▌
█████▌▄▌▄▐▐▌██▌▀▀██▀▀
███▄█▌▄▌▄▐▐▌▀██▄▄█▌
▄▄▄▄█████████████

Something went wrong :(
*/

Inject your own logger (override default console.error)

const logWarn = {
    error: (msg: any) => console.warn(msg)
}

failWhale("Warn you instead", logWarn)

/* 
Prints to console.warn:
▄████████████▄▐█▄▄▄▄█▌
█████▌▄▌▄▐▐▌██▌▀▀██▀▀
███▄█▌▄▌▄▐▐▌▀██▄▄█▌
▄▄▄▄█████████████

Warn you instead
*/

Package Sidebar

Install

npm i fail-whale

Weekly Downloads

19

Version

1.0.7

License

MIT

Unpacked Size

8.11 kB

Total Files

19

Last publish

Collaborators

  • stephenmp