How to use the @slack/rtm-api.LogLevel.DEBUG function in @slack/rtm-api

To help you get started, we’ve selected a few @slack/rtm-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matrix-org / matrix-appservice-slack / src / SlackRTMHandler.ts View on Github external
private createRtmClient(token: string, logLabel: string): RTMClient {
        const LOG_LEVELS = ["debug", "info", "warn", "error", "silent"];
        const connLog = Logging.get(`RTM-${logLabel.substr(0, LOG_TEAM_LEN)}`);
        const logLevel = LOG_LEVELS.indexOf(this.main.config.rtm!.log_level || "silent");
        const rtm = new RTMClient(token, {
            logLevel: LogLevel.DEBUG, // We will filter this ourselves.
            logger: {
                getLevel: () => LogLevel.DEBUG,
                setLevel: () => {},
                setName: () => {}, // We handle both of these ourselves.
                debug: logLevel <= 0 ? connLog.debug.bind(connLog) : () => {},
                warn: logLevel <= 1 ? connLog.warn.bind(connLog) : () => {},
                info: logLevel <= 2 ? connLog.info.bind(connLog) : () => {},
                error: logLevel <= 3 ? connLog.error.bind(connLog) : () => {},
            } as Logger,
        });

        rtm.on("error", (error) => {
            // We must handle this lest the process be killed.
            connLog.error("Encountered 'error' event:", error);
        });
        return rtm;

@slack/rtm-api

Official library for using the Slack Platform's Real Time Messaging API

MIT
Latest version published 3 months ago

Package Health Score

95 / 100
Full package analysis