import { isObject } from "./common" ; const logger = console ; type LogType = "loading" | "success" | "error" | "unknown" | "create" | "update" | "delete" ; const emojiMap = { delete : "🗑" , create : "🧱" , error : "🔥" , loading : "⏳" , success : "🎉" , unknown : "🤷‍" , update : "✏️" , } ; const logCaption = ( type , title ) => `${ emojiMap [ type ] } ${ title }` ; function plain ( data ) { if ( isObject ( data ) ) { logger . dir ( data , { depth : null , colors : true } ) ; return ; } logger . log ( data ) ; } function message ( type , logMessage , data ? ) { const formattedTitle = logCaption ( type , logMessage ) ; const separators = "=" . repeat ( 10 ) ; logger . log ( "\n%s\n" , `${ separators } ${ formattedTitle } ${ separators }` ) ; if ( data ) { logger . dir ( data , { depth : null , colors : true } ) ; } } const log = { message , plain , } ; export default log ;