<commit_before>#pragma once

#include <pqrs/osx/iokit_hid_device_open_checker.hpp>

namespace krbn {
namespace iokit_hid_device_open_checker_utility {
inline bool run_checker(void) {
  bool result = true;

  auto global_wait = pqrs::make_thread_wait();

  std::vector<pqrs::cf::cf_ptr<CFDictionaryRef>> matching_dictionaries{
      pqrs::osx::iokit_hid_manager::make_matching_dictionary(
          pqrs::osx::iokit_hid_usage_page_generic_desktop,
          pqrs::osx::iokit_hid_usage_generic_desktop_keyboard),

      pqrs::osx::iokit_hid_manager::make_matching_dictionary(
          pqrs::osx::iokit_hid_usage_page_generic_desktop,
          pqrs::osx::iokit_hid_usage_generic_desktop_mouse),

      pqrs::osx::iokit_hid_manager::make_matching_dictionary(
          pqrs::osx::iokit_hid_usage_page_generic_desktop,
          pqrs::osx::iokit_hid_usage_generic_desktop_pointer),
  };

  auto checker = std::make_unique<pqrs::osx::iokit_hid_device_open_checker>(pqrs::dispatcher::extra::get_shared_dispatcher(),
                                                                            matching_dictionaries);

  checker->device_open_permitted.connect([&] {
    result = true;
    global_wait->notify();
  });

  checker->device_open_forbidden.connect([&] {
    result = false;
    global_wait->notify();
  });

  checker->async_start();

  global_wait->wait_notice();

  return result;
}
} // namespace iokit_hid_device_open_checker_utility
} // namespace krbn<commit_msg>add log messages<commit_after>#pragma once

#include "logger.hpp"
#include <pqrs/osx/iokit_hid_device_open_checker.hpp>

namespace krbn {
namespace iokit_hid_device_open_checker_utility {
inline bool run_checker(void) {
  bool result = true;

  auto global_wait = pqrs::make_thread_wait();

  std::vector<pqrs::cf::cf_ptr<CFDictionaryRef>> matching_dictionaries{
      pqrs::osx::iokit_hid_manager::make_matching_dictionary(
          pqrs::osx::iokit_hid_usage_page_generic_desktop,
          pqrs::osx::iokit_hid_usage_generic_desktop_keyboard),

      pqrs::osx::iokit_hid_manager::make_matching_dictionary(
          pqrs::osx::iokit_hid_usage_page_generic_desktop,
          pqrs::osx::iokit_hid_usage_generic_desktop_mouse),

      pqrs::osx::iokit_hid_manager::make_matching_dictionary(
          pqrs::osx::iokit_hid_usage_page_generic_desktop,
          pqrs::osx::iokit_hid_usage_generic_desktop_pointer),
  };

  auto checker = std::make_unique<pqrs::osx::iokit_hid_device_open_checker>(pqrs::dispatcher::extra::get_shared_dispatcher(),
                                                                            matching_dictionaries);

  checker->device_open_permitted.connect([&] {
    logger::get_logger()->info("device_open_permitted");
    result = true;
    global_wait->notify();
  });

  checker->device_open_forbidden.connect([&] {
    logger::get_logger()->info("device_open_forbidden");
    result = false;
    global_wait->notify();
  });

  checker->async_start();

  global_wait->wait_notice();

  return result;
}
} // namespace iokit_hid_device_open_checker_utility
} // namespace krbn
{'fraction_non_alphanumeric': 0.11532231940395206, 'fraction_numerical': 0.0, 'mean_word_length': 4.233898305084746, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3949754', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1063, 'n_words': 101}