diff options
Diffstat (limited to 'core/os/os.cpp')
| -rw-r--r-- | core/os/os.cpp | 42 | 
1 files changed, 31 insertions, 11 deletions
diff --git a/core/os/os.cpp b/core/os/os.cpp index dc8bd5ee69..ca1b798e11 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -5,8 +5,8 @@  /*                           GODOT ENGINE                                */  /*                      https://godotengine.org                          */  /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */  /*                                                                       */  /* Permission is hereby granted, free of charge, to any person obtaining */  /* a copy of this software and associated documentation files (the       */ @@ -30,11 +30,11 @@  #include "os.h" +#include "core/config/project_settings.h"  #include "core/input/input.h"  #include "core/os/dir_access.h"  #include "core/os/file_access.h"  #include "core/os/midi_driver.h" -#include "core/project_settings.h"  #include "core/version_generated.gen.h"  #include "servers/audio_server.h" @@ -80,10 +80,6 @@ String OS::get_iso_date_time(bool local) const {  		   timezone;  } -uint64_t OS::get_splash_tick_msec() const { -	return _msec_splash; -} -  double OS::get_unix_time() const {  	return 0;  } @@ -110,10 +106,18 @@ void OS::add_logger(Logger *p_logger) {  }  void OS::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type) { +	if (!_stderr_enabled) { +		return; +	} +  	_logger->log_error(p_function, p_file, p_line, p_code, p_rationale, p_type);  }  void OS::print(const char *p_format, ...) { +	if (!_stdout_enabled) { +		return; +	} +  	va_list argp;  	va_start(argp, p_format); @@ -123,6 +127,10 @@ void OS::print(const char *p_format, ...) {  }  void OS::printerr(const char *p_format, ...) { +	if (!_stderr_enabled) { +		return; +	} +  	va_list argp;  	va_start(argp, p_format); @@ -167,6 +175,22 @@ bool OS::is_stdout_debug_enabled() const {  	return _debug_stdout;  } +bool OS::is_stdout_enabled() const { +	return _stdout_enabled; +} + +bool OS::is_stderr_enabled() const { +	return _stderr_enabled; +} + +void OS::set_stdout_enabled(bool p_enabled) { +	_stdout_enabled = p_enabled; +} + +void OS::set_stderr_enabled(bool p_enabled) { +	_stderr_enabled = p_enabled; +} +  void OS::dump_memory_to_file(const char *p_file) {  	//Memory::dump_static_mem_to_file(p_file);  } @@ -509,12 +533,8 @@ void OS::add_frame_delay(bool p_can_draw) {  }  OS::OS() { -	void *volatile stack_bottom; -  	singleton = this; -	_stack_bottom = (void *)(&stack_bottom); -  	Vector<Logger *> loggers;  	loggers.push_back(memnew(StdLogger));  	_set_logger(memnew(CompositeLogger(loggers)));  |