Debug

DebugThread object

thread.log(options)

import { DebugThread } from '@empathize/framework';

function exampleFunction()
{
    const debugThread = new DebugThread('exampleFunction', 'Initialized');
    
    // do some stuff
    
    debugThread.log({
        message: [
            'list',
            'of',
            'lines'
        ]
    });
}

DebugOptions

Name
Type
Description

message

string | string[] | object

Message to log. If string - single line; list of strings - multiple lines; object - in format [key]: value

function?

string

Name of function log should be written as

thread?

number

Id of a thread (random number)

Debug class

Debug.log(options)

Debug.merge(records)

Merges log records with currently stored. Windows in neutralino work as separate processes, so Debug class in the main window will be different from Debug class in the about window. So, to have a complete log from all the windows, you should send them by, for example, IPC.write() method to your main window, and then merge it by this method

How Debug.merge() should be used

About window

Main window

Debug.getRecords()

System class that used primarily with Debug.merge()

Debug.get()

Returns list of strings

Debug.handler(callback)

Debug.loggable(func)

This method will return a new function that will log some user-specified strings at the start and at the end of its work

How Debug.loggable() works

Sync functions

Async functions

This function is highly useful to generate log generation in your already existing code without modifying it. For example:

Property context means an object or class at which name this function should be called. Because we're making a copy of the original function - this copy will have no access to this, and to manually give this function this value - you should specify its context - parent class or object this function belongs to

Last updated