Skip to content
No description, website, or topics provided.
JavaScript HCL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
src
.eslintignore
.eslintrc.js
.gitignore
.npmignore
LICENSE
README.md
babel.config.js
jest.config.js
lint-staged.config.js
package.json
yarn.lock

README.md

CDS Log Driver 🇨🇦

Phase Maintainability

(la version française suit)

Log driving is a means of moving logs (sawn tree trunks) from a forest to sawmills and pulp mills downstream using the current of a river.

In our case we want to move logs (console messages) out of developer consoles and into places like StackDriver.

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: "/"
};

Install with yarn add @cdssnc/logdriver or npm install @cdssnc/logdriver.

Adapters

StackDriver Node

Add credentials to you .env file

GOOGLE_APPLICATION_CREDENTIALS="...67550c60cde8.json"

Import the logger into your app

import { Logger, StackDriverNode } from "@cdssnc/logger";
Logger.subscribe("error", StackDriverNode.log);
Logger.debug("The message from the server"); //logs to console + StackDriver

StackDriver Client

import { Logger, StackDriverClient } from "@cdssnc/logger";

StackDriverClient.init(
   "your-api-key",
   "your-project-id"
);

// window.onError should now catch and report to StackDriver
Logger.subscribe("error", StackDriverClient.log);
Logger.warn("Client side message sent to StackDriver");

Questions?

Please contact us through any of the multiple ways listed on our website.

Camelot du SNC

Un camelot déplace des journaux (publications sur l’actualité) d’un distributeur au domicile des gens. Dans notre cas, nous voulons déplacer les journaux (messages de console) des consoles de développeurs vers des endroits comme StackDriver.

Le Camelot du SNC est un outil qui crée un format de journalisation normalisé pour les données de sortie + la collecte de journaux.

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: "/"
};

Installez cet outil avec yarn add @cdssnc/logdriver ou npm install @cdssnc/logdriver.

Connecteurs

Nœud StackDriver

Ajoutez des justificatifs d’identité au fichier .env

GOOGLE_APPLICATION_CREDENTIALS="...67550c60cde8.json"

Importez l’enregistreur dans votre application

import { Logger, StackDriverNode } from "@cdssnc/logger";
Logger.subscribe("error", StackDriverNode.log);
Logger.debug("The message from the server"); //logs to console + StackDriver

Client StackDriver

import { Logger, StackDriverClient } from "@cdssnc/logger";

StackDriverClient.init(
   "your-api-key",
   "your-project-id"
);

// window.onError should now catch and report to StackDriver
Logger.subscribe("error", StackDriverClient.log);
Logger.warn("Client side message sent to StackDriver");

Avez-vous des questions?

Veuillez communiquer avec nous par l’un des multiples moyens indiqués sur notre site Web.

You can’t perform that action at this time.