@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 845 B
JavaScript
import{colorize as e,consoleColors as t,createPrefix as n,formatDuration as r,formatTimestamp as i}from"./formatters.mjs";const a=e=>{if(e.event!==`http.request.completed`)return!1;let t=e.data?.path,n=e.data?.status;return typeof t==`string`&&t.startsWith(`/lucid/assets/`)&&typeof n==`number`&&n<400},o=(o,s)=>{if(!s.verbose&&a(o))return!0;let c=o.data?.method,l=o.data?.path,u=o.data?.status,d=o.data?.durationMs;if(typeof c!=`string`||typeof l!=`string`||typeof u!=`number`||typeof d!=`number`)return!1;let f=u>=500?t.error:u>=400?t.warn:t.success,p=n({color:t.http,colors:s.colors,label:`HTTP`,timestamp:i(o.timestamp,s.timestamps)}),m=e(String(u),f,s.colors);return console.info(`${p} ${c} ${l} ${m} ${r(d)}`),s.verbose&&console.info(e(` Data:`,t.dim,s.colors),o.data),!0};export{o as writeHttpEntry};
//# sourceMappingURL=http.mjs.map