Allow logging save only to a file
This commit is contained in:
parent
4ac34fac76
commit
6536a311b3
lib/irrlicht/source/Irrlicht
src
@ -48,9 +48,9 @@ CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
|
||||
}
|
||||
else
|
||||
FileSystem = io::createFileSystem();
|
||||
core::stringc s = "Irrlicht Engine version ";
|
||||
s.append(getVersion());
|
||||
os::Printer::log(s.c_str(), ELL_INFORMATION);
|
||||
//core::stringc s = "Irrlicht Engine version ";
|
||||
//s.append(getVersion());
|
||||
//os::Printer::log(s.c_str(), ELL_INFORMATION);
|
||||
|
||||
checkVersion(params.SDK_version_do_not_use);
|
||||
}
|
||||
|
@ -837,17 +837,6 @@ namespace UserConfigParams
|
||||
PARAM_PREFIX BoolUserConfigParam m_crashed
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "crashed") );
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
// No console on windows
|
||||
# define CONSOLE_DEFAULT false
|
||||
#else
|
||||
# define CONSOLE_DEFAULT true
|
||||
#endif
|
||||
// No console on windows
|
||||
PARAM_PREFIX BoolUserConfigParam m_log_errors_to_console
|
||||
PARAM_DEFAULT( BoolUserConfigParam(
|
||||
CONSOLE_DEFAULT, "log_errors", "Enable logging to console.") );
|
||||
|
||||
// ---- Camera
|
||||
PARAM_PREFIX GroupUserConfigParam m_camera
|
||||
PARAM_DEFAULT( GroupUserConfigParam("camera",
|
||||
|
@ -592,7 +592,6 @@ void cmdLineHelp()
|
||||
" --max-players=n Maximum number of clients (server only).\n"
|
||||
" --no-console Does not write messages in the console but to\n"
|
||||
" stdout.log.\n"
|
||||
" --console Write messages in the console and files\n"
|
||||
" -h, --help Show this help.\n"
|
||||
" --log=N Set the verbosity to a value between\n"
|
||||
" 0 (Debug) and 5 (Only Fatal messages)\n"
|
||||
@ -676,12 +675,8 @@ int handleCmdLineOutputModifier()
|
||||
Log::disableColor();
|
||||
Log::verbose("main", "Colours disabled.");
|
||||
}
|
||||
|
||||
if(CommandLine::has("--console"))
|
||||
UserConfigParams::m_log_errors_to_console=true;
|
||||
if(CommandLine::has("--no-console"))
|
||||
UserConfigParams::m_log_errors_to_console=false;
|
||||
|
||||
Log::toggleConsoleLog(false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -734,7 +729,6 @@ int handleCmdLinePreliminary()
|
||||
if(CommandLine::has("--no-graphics") || CommandLine::has("-l"))
|
||||
{
|
||||
ProfileWorld::disableGraphics();
|
||||
UserConfigParams::m_log_errors_to_console=true;
|
||||
}
|
||||
|
||||
if(CommandLine::has("--screensize", &s) || CommandLine::has("-s", &s))
|
||||
|
@ -58,9 +58,6 @@ void override_default_params()
|
||||
|
||||
// Create default user istead of showing login screen to make life easier
|
||||
UserConfigParams::m_enforce_current_player = true;
|
||||
|
||||
// Just for debugging
|
||||
UserConfigParams::m_log_errors_to_console = true;
|
||||
}
|
||||
|
||||
void android_main(struct android_app* app)
|
||||
|
@ -177,7 +177,7 @@ DictionaryManager::get_dictionary(const Language& language)
|
||||
|
||||
if (language.get_country().size() > 0)
|
||||
{
|
||||
printf("Adding language fallback %s\n", language.get_language().c_str());
|
||||
Log::info("tinygettext", "Adding language fallback %s\n", language.get_language().c_str());
|
||||
dict->addFallback( &get_dictionary(Language::from_spec(language.get_language())) );
|
||||
}
|
||||
return *dict;
|
||||
|
@ -61,9 +61,6 @@ void CommandLine::reportInvalidParameters()
|
||||
{
|
||||
for(unsigned int i=0; i<m_argv.size(); i++)
|
||||
{
|
||||
// invalid param needs to go to console
|
||||
UserConfigParams::m_log_errors_to_console = true;
|
||||
|
||||
Log::error("CommandLine", "Invalid parameter: %s.", m_argv[i].c_str() );
|
||||
}
|
||||
} // reportInvalidParameters
|
||||
|
@ -37,6 +37,7 @@ bool Log::m_no_colors = false;
|
||||
FILE* Log::m_file_stdout = NULL;
|
||||
std::string Log::m_prefix = "";
|
||||
size_t Log::m_buffer_size = 1;
|
||||
bool Log::m_console_log = true;
|
||||
Synchronised<std::vector<struct Log::LineInfo> > Log::m_line_buffer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -46,6 +47,8 @@ Synchronised<std::vector<struct Log::LineInfo> > Log::m_line_buffer;
|
||||
*/
|
||||
void Log::setTerminalColor(LogLevel level)
|
||||
{
|
||||
if (!m_console_log) return;
|
||||
|
||||
if(m_no_colors) return;
|
||||
|
||||
// Thanks to funto for the colouring code!
|
||||
@ -109,6 +112,8 @@ void Log::setTerminalColor(LogLevel level)
|
||||
*/
|
||||
void Log::resetTerminalColor()
|
||||
{
|
||||
if (!m_console_log) return;
|
||||
|
||||
if(m_no_colors) return;
|
||||
|
||||
#ifdef WIN32
|
||||
@ -198,32 +203,33 @@ void Log::writeLine(const char *line, int level)
|
||||
{
|
||||
|
||||
// If we don't have a console file, write to stdout and hope for the best
|
||||
if ( m_buffer_size <= 1 &&
|
||||
(!m_file_stdout || level >= LL_WARN ||
|
||||
UserConfigParams::m_log_errors_to_console) ) // log to console
|
||||
if (m_buffer_size <= 1 || !m_file_stdout)
|
||||
{
|
||||
setTerminalColor((LogLevel)level);
|
||||
#ifdef ANDROID
|
||||
android_LogPriority alp;
|
||||
switch (level)
|
||||
if (m_console_log)
|
||||
{
|
||||
// STK is using the levels slightly different from android
|
||||
// (debug lowest, verbose above it; while android reverses
|
||||
// this order. So to get the same behaviour (e.g. filter
|
||||
// out debug message, but still get verbose, we swap
|
||||
// the order here.
|
||||
case LL_VERBOSE: alp = ANDROID_LOG_DEBUG; break;
|
||||
case LL_DEBUG: alp = ANDROID_LOG_VERBOSE; break;
|
||||
case LL_INFO: alp = ANDROID_LOG_INFO; break;
|
||||
case LL_WARN: alp = ANDROID_LOG_WARN; break;
|
||||
case LL_ERROR: alp = ANDROID_LOG_ERROR; break;
|
||||
case LL_FATAL: alp = ANDROID_LOG_FATAL; break;
|
||||
default: alp = ANDROID_LOG_FATAL;
|
||||
}
|
||||
__android_log_print(alp, "SuperTuxKart", "%s", line);
|
||||
#ifdef ANDROID
|
||||
android_LogPriority alp;
|
||||
switch (level)
|
||||
{
|
||||
// STK is using the levels slightly different from android
|
||||
// (debug lowest, verbose above it; while android reverses
|
||||
// this order. So to get the same behaviour (e.g. filter
|
||||
// out debug message, but still get verbose, we swap
|
||||
// the order here.
|
||||
case LL_VERBOSE: alp = ANDROID_LOG_DEBUG; break;
|
||||
case LL_DEBUG: alp = ANDROID_LOG_VERBOSE; break;
|
||||
case LL_INFO: alp = ANDROID_LOG_INFO; break;
|
||||
case LL_WARN: alp = ANDROID_LOG_WARN; break;
|
||||
case LL_ERROR: alp = ANDROID_LOG_ERROR; break;
|
||||
case LL_FATAL: alp = ANDROID_LOG_FATAL; break;
|
||||
default: alp = ANDROID_LOG_FATAL;
|
||||
}
|
||||
__android_log_print(alp, "SuperTuxKart", "%s", line);
|
||||
#else
|
||||
printf("%s", line);
|
||||
printf("%s", line);
|
||||
#endif
|
||||
}
|
||||
resetTerminalColor(); // this prints a \n
|
||||
}
|
||||
|
||||
@ -241,6 +247,12 @@ void Log::writeLine(const char *line, int level)
|
||||
#endif
|
||||
} // _fluhBuffers
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void Log::toggleConsoleLog(bool val)
|
||||
{
|
||||
m_console_log = val;
|
||||
} // toggleConsoleLog
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Flushes all stored log messages to the various output devices (thread safe).
|
||||
*/
|
||||
|
@ -60,6 +60,9 @@ private:
|
||||
/** If set this will disable coloring of log messages. */
|
||||
static bool m_no_colors;
|
||||
|
||||
/** If false that logging will only be saved to a file. */
|
||||
static bool m_console_log;
|
||||
|
||||
/** The file where stdout output will be written */
|
||||
static FILE* m_file_stdout;
|
||||
|
||||
@ -117,6 +120,7 @@ public:
|
||||
|
||||
static void closeOutputFiles();
|
||||
static void flushBuffers();
|
||||
static void toggleConsoleLog(bool val);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets the number of lines to buffer. Setting the buffer size to a
|
||||
|
Loading…
x
Reference in New Issue
Block a user