void GDMonoLog::initialize() { #ifdef DEBUG_ENABLED const char *log_level = "debug"; #else const char *log_level = "warning"; #endif String logs_dir = GodotSharpDirs::get_mono_logs_dir(); if (_try_create_logs_dir(logs_dir)) { _delete_old_log_files(logs_dir); log_file_path = logs_dir.plus_file(String::num_int64(OS::get_singleton()->get_unix_time()) + ".txt"); _open_log_file(log_file_path); } mono_trace_set_level_string(log_level); log_level_id = log_level_get_id(log_level); if (log_file) { print_verbose("Mono: Logfile is " + log_file_path); mono_trace_set_log_handler(mono_log_callback, this); } else { OS::get_singleton()->printerr("Mono: No log file, using default log handler\n"); } }
/** * mono_trace_init: * * Initializes the mono tracer. */ static void mono_trace_init (void) { if(level_stack == NULL) { level_stack = g_queue_new(); mono_trace_set_mask_string(g_getenv("MONO_LOG_MASK")); mono_trace_set_level_string(g_getenv("MONO_LOG_LEVEL")); } }
void MonoRuntime::Load(std::string assemblyDir, std::string configDir, std::string traceLevel, std::string file) { if (isLoaded_) { return; } if (!assemblyDir.empty() && !configDir.empty()) { mono_set_dirs(assemblyDir.c_str(), configDir.c_str()); } #ifdef _WIN32 else { mono_set_dirs(PathUtil::GetLibDirectory().c_str(), PathUtil::GetConfigDirectory().c_str()); } #endif mono_trace_set_level_string(traceLevel.c_str()); MonoDomain *dom = mono_jit_init(file.c_str()); isLoaded_ = true; }