Esempio n. 1
0
bool Logger::init() {
  if (installed_) {
    g_warning("Only one logger instance is possible, cannot create");
    return false;
  } else {
    installed_ = true;
    i_am_the_one_ = true;
  }

  guint quiet_handler_id =
      g_log_set_handler("GLib-GObject", G_LOG_LEVEL_MASK, quiet_log_handler, nullptr);

  // handler must be installed after custom property creation
  handler_ids_["switcher"] = g_log_set_handler("switcher", G_LOG_LEVEL_MASK, log_handler, this);

  g_log_remove_handler("GLib-GObject", quiet_handler_id);

  install_method(
      "Install Log Handler",
      "install_log_handler",
      "make the logger managing the log domain",
      "success or fail",
      Method::make_arg_description("LogDomain",
                                   "log domain",
                                   "the glib log domain (e.g. shmdata, Glib or GStreamer)",
                                   nullptr),
      (Method::method_ptr)&install_log_handler_wrapped,
      G_TYPE_BOOLEAN,
      Method::make_arg_type_description(G_TYPE_STRING, nullptr),
      this);

  install_method(
      "Remove Log Handler",
      "remove_log_handler",
      "make the logger stop managing the log domain",
      "success or fail",
      Method::make_arg_description("Log Domain",
                                   "log domain",
                                   "the glib log domain (e.g. shmdata, Glib or GStreamer)",
                                   nullptr),
      (Method::method_ptr)&remove_log_handler_wrapped,
      G_TYPE_BOOLEAN,
      Method::make_arg_type_description(G_TYPE_STRING, nullptr),
      this);

  return true;
}
Esempio n. 2
0
bool OscCtrlServer::init() {
  osc_thread_ = nullptr;
  install_method("Set Port",
                 "set_port",
                 "set the port used by the osc server and start listening messages",
                 "success or fail",
                 Method::make_arg_description("Port",
                                              "port",
                                              "the port to bind",
                                              nullptr),
                 (Method::method_ptr) &set_port_wrapped,
                 G_TYPE_BOOLEAN,
                 Method::make_arg_type_description(G_TYPE_STRING,
                                                   nullptr), this);
  return true;
}