Web SDK - RainwayLogging

Home > rainway-sdk > RainwayLogging

RainwayLogging class

A class for Rainway SDK logging.

To enable logging, call RainwayLogging.setLogSink() with a custom handler. This handler should decide whether a message is worth logging based on its severity level, and then do whatever it wants with the message string (write it to a file, display it, etc.)

This should probably be done before instantiating a RainwayRuntime. However, it's also possible to call RainwayLogging.setLogSink() at a later point in time.

Signature:

export declare class RainwayLogging 

Properties

PropertyModifiersTypeDescription
_logSinkstaticRainwayLogSink
criticalstatic(message: string) => voidLog a message to the current log sink at the Critical level.
debugstatic(message: string) => voidLog a message to the current log sink at the Debug level.
errorstatic(message: string) => voidLog a message to the current log sink at the Error level.
informationstatic(message: string) => voidLog a message to the current log sink at the Information level.
tracestatic(message: string) => voidLog a message to the current log sink at the Trace level.
warningstatic(message: string) => voidLog a message to the current log sink at the Warning level.

Methods

MethodModifiersDescription
log(level, message)staticLog a message to the current log sink at the given level.
setLogSink(logSink)staticSet 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.)