UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 901 B
import{colorize as e,consoleColors as t,createPrefix as n,formatTimestamp as r,getConsoleLogger as i,getErrorMessage as a,levelLabels as o}from"./formatters.mjs";import{writeHttpEntry as s}from"./http.mjs";const c=(n,r)=>{if(!r.verbose)return;let a=i(n.level);n.error instanceof Error&&n.error.stack&&a(e(` ${n.error.stack}`,t.dim,r.colors)),n.data!==void 0&&a(e(` Data:`,t.dim,r.colors),n.data)},l=(e,s)=>{let l=n({color:t[e.level],colors:s.colors,label:o[e.level],scope:e.scope,timestamp:r(e.timestamp,s.timestamps)}),u=a(e),d=u&&!e.message.includes(u)?` — ${u}`:``;i(e.level)(`${l} ${e.message}${d}`),c(e,s)},u=(e={})=>{let t={colors:e.colors??(typeof process<`u`&&!!(process.stdout?.isTTY||process.stderr?.isTTY)),timestamps:e.timestamps??!0,verbose:e.verbose??!1};return{write:e=>{e.event===`http.request.completed`&&s(e,t)||l(e,t)}}};export{u as default}; //# sourceMappingURL=index.mjs.map