How to use the buttplug.ButtplugLogger.Logger function in buttplug

To help you get started, we’ve selected a few buttplug 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 buttplugio / buttplug-js / packages / buttplug-node-bluetoothle-manager / src / ButtplugNodeBluetoothLEDeviceManager.ts View on Github external
*
 * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
 */
import * as noble from "noble-mac";
import { IDeviceSubtypeManager, ButtplugLogger, DeviceConfigurationManager,
         BluetoothLEProtocolConfiguration, ButtplugDevice, ButtplugException,
         ButtplugDeviceException } from "buttplug";
import { EventEmitter } from "events";
import { ButtplugNodeBluetoothLEDevice } from "./ButtplugNodeBluetoothLEDevice";

export class ButtplugNodeBluetoothLEDeviceManager extends EventEmitter implements IDeviceSubtypeManager {

  private isScanning: boolean = false;
  private initializerPromise: Promise | null;
  // Set to default logger to make sure we have something at startup.
  private logger: ButtplugLogger = ButtplugLogger.Logger;

  constructor() {
    super();
    noble.on("discover", async (d: noble.Peripheral) => {
      await this.OpenDevice(d);
    });
  }

  public async Initialize() {
    let res;
    let rej;
    this.initializerPromise = new Promise((resolve, reject) => {
      res = resolve;
      rej = reject;
    });
    noble.on("stateChange", function(state) {
github buttplugio / buttplug-js / packages / buttplug-server-cli / src / ButtplugServerCLI.ts View on Github external
private LogToConsole() {
    ButtplugLogger.Logger.MaximumConsoleLogLevel = ButtplugLogLevel[commander.log as string];
  }
github buttplugio / buttplug-js / packages / buttplug-web-devtools / src / LogPanel.ts View on Github external
constructor() {
    this.logTextArea = document.getElementById("buttplugdevtoolslogtextarea")! as HTMLTextAreaElement;
    this.panelLevelSelect = document.getElementById("buttplugdevtoolsloglevelpanelselect")! as HTMLSelectElement;
    this.consoleLevelSelect = document.getElementById("buttplugdevtoolsloglevelconsoleselect")! as HTMLSelectElement;
    const log = ButtplugLogger.Logger;
    log.addListener("log", (msg) => {
      this.addLogMessage(msg);
    });
    this.panelLevelSelect.addEventListener("change", () => {
      log.MaximumEventLogLevel = ButtplugLogLevel[this.panelLevelSelect.value];
    });
    this.consoleLevelSelect.addEventListener("change", () => {
      log.MaximumConsoleLogLevel = ButtplugLogLevel[this.consoleLevelSelect.value];
    });
    log.MaximumEventLogLevel = ButtplugLogLevel.Debug;
    log.Debug("LogPanel: DevTools Log panel enabled.");
  }
github buttplugio / buttplug-js / packages / buttplug-node-websockets / src / ButtplugNodeWebsocketClientConnector.ts View on Github external
this.wsClient.on("error", (e) =>
                       ButtplugLogger.Logger.Info("Websocket Error (Happens on close, possibly ignorable): " + e));
      res();
github buttplugio / buttplug-js / packages / buttplug-web-devtools / src / TestDeviceManagerPanel.ts View on Github external
public static ShowTestDeviceManagerPanel(buttplugServer: ButtplugServer) {
    let tdm: TestDeviceSubtypeManager | null = null;
    for (const mgr of buttplugServer.DeviceManagers) {
      if (mgr instanceof TestDeviceSubtypeManager) {
        tdm = (mgr as TestDeviceSubtypeManager);
        break;
      }
    }
    if (tdm === null) {
      ButtplugLogger.Logger.Error("TestDeviceSubtypeManagerPanel: Cannot get test device manager from server.");
      throw new Error("Cannot get test device manager from server.");
    }
    jsPanel.jsPanel.create({
      id: () => "buttplug-test-device-manager-panel",
      theme:       "primary",
      headerTitle: "Test Device Manager",
      position:    "center-top 0 80",
      contentSize: "400 250",
      callback() {
        this.content.innerHTML = testPanelHTML;
        TestDeviceManagerPanel._panel = new TestDeviceManagerPanel(tdm!);
      },
    });
  }