new logging

This commit is contained in:
Adam Matthiesen 2024-03-05 01:16:10 -08:00
parent bc3ec6d653
commit b1d7a044cf
1 changed files with 15 additions and 27 deletions

View File

@ -44,19 +44,18 @@ export default defineIntegration({
// Configure Loggers // Configure Loggers
const GhostLogger = logger.fork(c.bold(c.blue("👻 Astro-GhostCMS"))); const GhostLogger = logger.fork(c.bold(c.blue("👻 Astro-GhostCMS")));
const loggerTagged = (message: string) => {
return logger.fork(`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.blue(message)}`)
}
// Configure ENV Logger // Configure ENV Logger
const GhostENVLogger = logger.fork( const GhostENVLogger = loggerTagged("ENV Check");
`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.blue(
"ENV Check",
)}`,
);
// Configure Integration Loggers & verbose logging // Configure Integration Loggers & verbose logging
const GhostIntegrationLogger = logger.fork( const GhostIntegrationLogger = loggerTagged("Integrations");
`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.blue(
"Integrations", // Configure Route Logger & verbose logging
)}`, const GhostRouteLogger = loggerTagged("Router");
);
// Log Info Helper // Log Info Helper
const intLogInfo = (message:string) => { const intLogInfo = (message:string) => {
@ -65,13 +64,6 @@ export default defineIntegration({
} }
}; };
// Configure Route Logger & verbose logging
const GhostRouteLogger = logger.fork(
`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.blue(
"Router",
)}`,
);
// Log Route Info Helper // Log Route Info Helper
const routeLogInfo = (message:string) => { const routeLogInfo = (message:string) => {
if (verbose) { if (verbose) {
@ -241,17 +233,13 @@ export default defineIntegration({
); );
}, },
"astro:server:start": async ({ logger }) => { "astro:server:start": async ({ logger }) => {
const loggerTagged = (message: string) => {
return logger.fork(`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.green(message)}`)
}
// Configure Loggers // Configure Loggers
const GhostLogger = logger.fork( const GhostLogger = loggerTagged("DEV");
`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.bold(
c.green("DEV"), const GhostUpdateLogger = loggerTagged("VERSION CHECK");
)}`,
);
const GhostUpdateLogger = logger.fork(
`${c.bold(c.blue("👻 Astro-GhostCMS"))}${c.gray("/")}${c.bold(
c.green("VERSION CHECK"),
)}`,
);
// Start the DEV server // Start the DEV server
GhostLogger.info( GhostLogger.info(