This ArcOS wiki is still under active development, and contains errors and unfinished pages.

Verbose logging

If you've ever opened the Logging app or peaked at the Developer Console, you'll know that ArcOS has a whole lot of logs, hundreds of them in fact. I did this to make walking through problems in ArcOS as easy as possible. Everything from opening files, checking for updates, spawning apps, even setting environment variables are logged so that I can walk through the logs in effort of finding a bug, without having to resort to tedious debugging using Chrome's developer tools.

Luckily, the sophisticated logging system I've implemented is also available to you. Every process you spawn has a Log method that you can call. This log method takes a message and a level, like so:

protected Log(message: string, level?: LogLevel): void;

The LogLevel type is actually an enum that represents the different kinds of log levels. Here it is:

export enum LogLevel {
    info = 0,
    warning = 1,
    error = 2,
    critical = 3
}

Because Javascript doesn't (natively) support enums, I've created a const equivalent as part of the TPA props so that you too can just enter LogLevel.error, just like me in TypeScript land.

What you shouldn't do:

Use console. The native Javascript console is only to be used by me when developing ArcOS. If you want to log something, and you need your log to stand out from the rest, just filter the developer console to the PID of your app, and find the debugging info you're looking for. Direct calls to console won't log anything.

Last updated