Projects // Chronicle Console

What is Chronicle Console?

Chronicle Console is a remote logging tool. It can be used as a replacement for the console object. Log messages are sent to a Chronicle API instance. It has been tested in node, the browser, and React Native.

Chronicle Console was built to be used with the Chronicle API and the Chronicle Client.

Usage

Chronicle Console uses the standard console methods:

console.log("What is up with this object?", objectToLog);
console.warn("You are getting close to the edge.");
console.error("Error!");

Basic Configuration

const config = {
    server: "https://xyz.chronicle.logging.server.com",
    app: "My App",
    globalize: true,
    methodsToLog: ["error", "warn"],
    toConsole: true
};

ChronicleConsole.init(config);
  • server - the url to the API
  • app - the name of the app
  • globalize - override the global console object
  • methodsToLog - array of the methods to log to the api
  • toConsole - show messages in the console

Check the README for all the options.

Custom Log Methods

In addition to the standard console methods, you can add your own logging functions using the customMethods config option.

const config = {
    server: "https://xyz.chronicle.logging.server.com",
    app: "My App",
    globalize: true,
    methodsToLog: ["error", "warn"],
    customMethods: ["crash"]
};

ChronicleConsole.init(config);

// The crash method is now available on the Chronicle
ChronicleConsole.crash("The system has crashed!");
console.crash("Frontend has crashed");