Web SDK - RainwayLogging.setLogSink()

Home > rainway-sdk > RainwayLogging > setLogSink

RainwayLogging.setLogSink() method

Set a handler for Rainway SDK-related logging. RainwayRuntime and its components will call this function to log information about their state and behavior.

## The setLogSink hack Normally, you would only have to call RainwayLogging.setLogSink to set the log sink. Unfortunately, a bug (in webpack?) is apparently causing calls to that function from _inside_ the SDK and from _outside_ the SDK to operate on two different "copies" of the RainwayLogging class. As a workaround, a method on RainwayRuntime is provided to set the "inside" logSink from the outside. You'll probably want to set both, like so:

const myRainwayRuntime = await RainwayRuntime.initialize(...); RainwayLogging.setLogSink(mySink); myRainwayRuntime.setLogSink(mySink);

(RainwayRuntime.setLogSink simply calls RainwayLogging.setLogSink again, but from _inside_ the SDK.)

Signature:

static setLogSink(logSink: RainwayLogSink): void;

Parameters

ParameterTypeDescription
logSinkRainwayLogSinkA function that handles logging calls. It is invoked with an importance level and a string message.

Returns:

void