Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "sentry/sentry_options.h"
#include "sentry/sentry_sdk.h"
#include "sentry/sentry_user.h"
#include "sentry/util/print.h"

#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/scene_tree.hpp>
Expand All @@ -37,8 +38,11 @@ using namespace sentry;

void initialize_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_CORE) {
sentry::util::print_debug("init level core");
} else if (p_level == godot::MODULE_INITIALIZATION_LEVEL_SERVERS) {
sentry::util::print_debug("init level servers");
} else if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
sentry::util::print_debug("init level scene");
GDREGISTER_CLASS(SentryLoggerLimits);
GDREGISTER_CLASS(SentryOptions);
GDREGISTER_INTERNAL_CLASS(RuntimeConfig);
Expand Down Expand Up @@ -67,6 +71,7 @@ void initialize_module(ModuleInitializationLevel p_level) {
SentrySDK *sentry_singleton = memnew(SentrySDK);
Engine::get_singleton()->register_singleton("SentrySDK", SentrySDK::get_singleton());
} else if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
sentry::util::print_debug("init level editor");
#ifdef TOOLS_ENABLED
#ifndef WINDOWS_ENABLED
GDREGISTER_INTERNAL_CLASS(SentryEditorExportPluginUnix);
Expand Down Expand Up @@ -94,7 +99,7 @@ GDExtensionBool GDE_EXPORT gdextension_init(GDExtensionInterfaceGetProcAddress p

init_obj.register_initializer(initialize_module);
init_obj.register_terminator(uninitialize_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_CORE);

return init_obj.init();
}
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/util/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace sentry::util {

template <typename... Args>
void print(sentry::Level p_level, const Variant &p_arg1, const Args &...p_args) {
if (!SentryOptions::get_singleton()->is_debug_enabled() && p_level < sentry::LEVEL_ERROR) {
if (SentryOptions::get_singleton().is_valid() && !SentryOptions::get_singleton()->is_debug_enabled() && p_level < sentry::LEVEL_ERROR) {
return;
}
if (SentryOptions::get_singleton()->get_diagnostic_level() > p_level) {
if (SentryOptions::get_singleton().is_valid() && SentryOptions::get_singleton()->get_diagnostic_level() > p_level) {
return;
}

Expand Down
Loading