base_integration.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "core/base_integration.h"
  8. #include "core/sandbox.h"
  9. #include "core/crash_reports.h"
  10. namespace Core {
  11. BaseIntegration::BaseIntegration(int argc, char *argv[])
  12. : Integration(argc, argv) {
  13. }
  14. void BaseIntegration::enterFromEventLoop(FnMut<void()> &&method) {
  15. Core::Sandbox::Instance().customEnterFromEventLoop(
  16. std::move(method));
  17. }
  18. bool BaseIntegration::logSkipDebug() {
  19. return !Logs::DebugEnabled() && Logs::started();
  20. }
  21. void BaseIntegration::logMessageDebug(const QString &message) {
  22. Logs::writeDebug(message);
  23. }
  24. void BaseIntegration::logMessage(const QString &message) {
  25. Logs::writeMain(message);
  26. }
  27. void BaseIntegration::setCrashAnnotation(
  28. const std::string &key,
  29. const QString &value) {
  30. CrashReports::SetAnnotation(key, value);
  31. }
  32. void BaseIntegration::logAssertionViolation(const QString &info) {
  33. Logs::writeMain("Assertion Failed! " + info);
  34. CrashReports::SetAnnotation("Assertion", info);
  35. }
  36. } // namespace Core