summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-24 14:58:36 +0200
committerGitHub <noreply@github.com>2018-08-24 14:58:36 +0200
commitd442f3d0aa4185f154bee396efaf24ceb73c9d84 (patch)
tree46086425e2349832e9f07f05492ac67d74ecc333 /core
parent548c26239907c34081a96bff61d653f2a32ac243 (diff)
parentde59fe04e73250229e6ac11f9314e1b75dbdef1a (diff)
Merge pull request #21351 from akien-mga/print_verbose
Add print_verbose to print to stdout only in verbose mode
Diffstat (limited to 'core')
-rw-r--r--core/io/resource_loader.cpp17
-rw-r--r--core/object.cpp6
-rw-r--r--core/print_string.cpp7
-rw-r--r--core/print_string.h1
-rw-r--r--core/string_db.cpp5
5 files changed, 17 insertions, 19 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 8b0655deb0..c01aff9144 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -204,8 +204,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
if (!p_no_cache && ResourceCache::has(local_path)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: " + local_path + " (cached)");
+ print_verbose("Loading resource: " + local_path + " (cached)");
if (r_error)
*r_error = OK;
return RES(ResourceCache::get(local_path));
@@ -216,9 +215,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p
ERR_FAIL_COND_V(path == "", RES());
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: " + path);
-
+ print_verbose("Loading resource: " + path);
RES res = _load(path, local_path, p_type_hint, p_no_cache, r_error);
if (res.is_null()) {
@@ -286,9 +283,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
if (!p_no_cache && ResourceCache::has(local_path)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: " + local_path + " (cached)");
-
+ print_verbose("Loading resource: " + local_path + " (cached)");
Ref<Resource> res_cached = ResourceCache::get(local_path);
Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault));
@@ -298,14 +293,10 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
bool xl_remapped = false;
String path = _path_remap(local_path, &xl_remapped);
-
ERR_FAIL_COND_V(path == "", Ref<ResourceInteractiveLoader>());
-
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: ");
+ print_verbose("Loading resource: " + path);
bool found = false;
-
for (int i = 0; i < loader_count; i++) {
if (!loader[i]->recognize_path(path, p_type_hint))
diff --git a/core/object.cpp b/core/object.cpp
index 76226d113a..e83abaece7 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -2080,10 +2080,10 @@ void ObjectDB::cleanup() {
String node_name;
if (instances[*K]->is_class("Node"))
- node_name = " - Node Name: " + String(instances[*K]->call("get_name"));
+ node_name = " - Node name: " + String(instances[*K]->call("get_name"));
if (instances[*K]->is_class("Resource"))
- node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path"));
- print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name);
+ node_name = " - Resource name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path"));
+ print_line("Leaked instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name);
}
}
}
diff --git a/core/print_string.cpp b/core/print_string.cpp
index 0355154488..e1e42d2b56 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -107,3 +107,10 @@ void print_error(String p_string) {
_global_unlock();
}
+
+void print_verbose(String p_string) {
+
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line(p_string);
+ }
+}
diff --git a/core/print_string.h b/core/print_string.h
index 3465888d4c..c1d2d0ff3a 100644
--- a/core/print_string.h
+++ b/core/print_string.h
@@ -58,5 +58,6 @@ extern bool _print_line_enabled;
extern bool _print_error_enabled;
extern void print_line(String p_string);
extern void print_error(String p_string);
+extern void print_verbose(String p_string);
#endif
diff --git a/core/string_db.cpp b/core/string_db.cpp
index 2475cbe3e8..067e4493a1 100644
--- a/core/string_db.cpp
+++ b/core/string_db.cpp
@@ -73,7 +73,6 @@ void StringName::cleanup() {
_Data *d = _table[i];
lost_strings++;
if (OS::get_singleton()->is_stdout_verbose()) {
-
if (d->cname) {
print_line("Orphan StringName: " + String(d->cname));
} else {
@@ -85,8 +84,8 @@ void StringName::cleanup() {
memdelete(d);
}
}
- if (OS::get_singleton()->is_stdout_verbose() && lost_strings) {
- print_line("StringName: " + itos(lost_strings) + " unclaimed string names at exit.");
+ if (lost_strings) {
+ print_verbose("StringName: " + itos(lost_strings) + " unclaimed string names at exit.");
}
lock->unlock();