Skip to content

Latest commit

 

History

History

npm

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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
*/