CDS Log Driver 🇨🇦
Creates a standardized logging format for output + log collection.
standardPayload = {
cloudEventsVersion: "0.2",
contentType: "text/plain",
data: msg,
eventID: uuidv4(),
eventTime: new Date().toISOString(),
eventType: "com.github.cds-snc." + level,
eventTypeVersion: "1.0",
source: "/"
};
Adapters
StackDriver Node
import { Logger, StackDriverNodeLogger } from "@cdssnc/logger";
Logger.subscribe("error", StackDriverNodeLogger.log);
Logger.debug("The message from the server");
StackDriver Client
import { Logger, StackDriverClient } from "@cdssnc/logger";
StackDriverClient.init(
"your-api-key",
"your-project-id"
);
Logger.subscribe("error", StackDriverClient.log);
Logger.warn("Client side message sent to StackDriver");