Skip to main content

log and Debug

Scramjet Cloud Platform is constantly monitoring the user's Sequence, and producing log output for a Sequence which can be accessible. Details of each invoked Sequence can be viewed through different methods. More information on Scramjet's object-logger .

  • SCP Console Panel > Space > Show logs > Download

  • For returnning the log through calling the logger method inside the main file. In order to be retrieved use
    /instance/<Instance-id>/log API endpoint. The below example will provide a brief illustration.

import { ReadableApp } from "@scramjet/types";

const app: ReadableApp<string> = async function(_stream) {

// Write to a instance logger. first parameter could be any on the following list:
// Logger has the following log levels:
// - **debug**
// - **error**
// - **fatal**
// - **info**
// - **trace**
// - **warn**

this.logger.write("INFO", "this is info log");
return Promise.resolve("end");
};
export default app;
  • For returning the log through calling the Error class inside the main file. In order to be retrieved through /instance/<Instance-id>/stderr API endpoint, or through CLI as si instance stderr <Instance-id>. The below example will provide a brief illustration.
import { ReadableApp } from "@scramjet/types";

const app: ReadableApp<string> = async function(_stream) {

// This will write an error message to stderr

const err = new Error("The Sequence was not completed");
console.error(err);

return Promise.resolve("end");
};

export default app;
  • For displaying the content a user can use /instance/<Instance-id>/stdout API endpoint, or through CLI as si instance stdout <Instance-id>. The below example will provide a brief illustration.
import { ReadableApp } from "@scramjet/types";

const app: ReadableApp<string> = async function(_stream) {

// This will write to a stdout

const random = Math.random();
console.log(random);

return Promise.resolve("end");
};

export default app;

Was it helpful?

Didn't find information needed?

Join our Scramjet Community on Discord, where you can get help from our engineers directly.