atriusmaps-node-sdk
Version:
This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information
2 lines (1 loc) • 1.04 kB
JavaScript
const e={black:"[30m",red:"[31m",green:"[32m",yellow:"[33m",blue:"[34m",magenta:"[35m",cyan:"[36m",white:"[37m"};function o(o,n={}){let r=o+": ",t=null;if(n.color)if(n.isBrowser)r="%c"+r,t=`color: ${n.color}`;else{const o=e[n.color];o&&(r=o+r)}function c(e){return function(...o){if(void 0===n.enabled||!!n.enabled||e===console.error){let c=[...o];t&&c.unshift(t),c.unshift(r),n.truncateObjects&&e!==console.error&&(c=c.map(e=>{return"object"==typeof e?(o=JSON.stringify(e),r=parseInt(String(n.truncateObjects),10)||100,o.length>r?o.substring(0,r)+"...":o):e;var o,r}));const l=!n.logFilter||((e,o)=>{const n=String(e[0]??"");return"string"==typeof o?n.includes(o):o.test(n)})(c,n.logFilter);(l||e===console.error)&&e.apply(console,c)}}}const l=c(n.trace?console.trace:console.log);return l.info=l,l.warn=c(console.warn),l.detailed=c(console.debug),l.error=c(console.error),l.setEnabled=e=>{n.enabled=e},l}function n(e,r={}){const t=o(e,r);return t.sublog=(o,t={})=>n(e+"."+o,Object.assign(Object.create(r),t)),t}export{n as initLog};