This commit is contained in:
botanic 2014-03-24 10:45:54 -07:00
commit 6c345bf6b7
2 changed files with 34 additions and 10 deletions

View file

@ -31,10 +31,10 @@
#include "nel/misc/mutex.h" #include "nel/misc/mutex.h"
#include "nel/misc/report.h" #include "nel/misc/report.h"
#include "nel/misc/system_utils.h" #include "nel/misc/system_utils.h"
#include "nel/misc/variable.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95 // these defines is for IsDebuggerPresent(). it'll not compile on windows 95
// just comment this and the IsDebuggerPresent to compile on windows 95 // just comment this and the IsDebuggerPresent to compile on windows 95
@ -57,6 +57,8 @@ using namespace std;
namespace NLMISC namespace NLMISC
{ {
CVariable<bool> StdDisplayerColor("nel", "StdDisplayerColor", "Enable colors in std displayer", true, 0, true);
static const char *LogTypeToString[][8] = { static const char *LogTypeToString[][8] = {
{ "", "ERR", "WRN", "INF", "DBG", "STT", "AST", "UKN" }, { "", "ERR", "WRN", "INF", "DBG", "STT", "AST", "UKN" },
{ "", "Error", "Warning", "Information", "Debug", "Statistic", "Assert", "Unknown" }, { "", "Error", "Warning", "Information", "Debug", "Statistic", "Assert", "Unknown" },
@ -139,9 +141,20 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
bool needSpace = false; bool needSpace = false;
//stringstream ss; //stringstream ss;
string str; string str;
#ifdef NL_OS_UNIX
bool colorSet = false;
#endif
if (args.LogType != CLog::LOG_NO) if (args.LogType != CLog::LOG_NO)
{ {
#ifdef NL_OS_UNIX
if (StdDisplayerColor.get())
{
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) { str += "\e[0;30m\e[41m"; colorSet = true; } // black text, red background
else if (args.LogType == CLog::LOG_WARNING) { str += "\e[0;91m"; colorSet = true; } // bright red text
else if (args.LogType == CLog::LOG_DEBUG) { str += "\e[0;34m"; colorSet = true; } // blue text
}
#endif
//ss << logTypeToString(args.LogType); //ss << logTypeToString(args.LogType);
str += logTypeToString(args.LogType); str += logTypeToString(args.LogType);
needSpace = true; needSpace = true;
@ -218,6 +231,13 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
} }
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
#ifdef NL_OS_UNIX
if (colorSet)
{
str += "\e[0m";
}
#endif
// Printf ? // Printf ?
if (consoleMode) if (consoleMode)
{ {

View file

@ -86,31 +86,31 @@ if not args.noconf:
try: try:
ExportBuildDirectory ExportBuildDirectory
except NameError: except NameError:
ExportBuildDirectory = "W:/export" ExportBuildDirectory = "T:/export"
try: try:
InstallDirectory InstallDirectory
except NameError: except NameError:
InstallDirectory = "W:/install" InstallDirectory = "T:/install"
try: try:
ClientDevDirectory ClientDevDirectory
except NameError: except NameError:
ClientDevDirectory = "W:/client_dev" ClientDevDirectory = "T:/client_dev"
try: try:
ClientPatchDirectory ClientPatchDirectory
except NameError: except NameError:
ClientPatchDirectory = "W:/client_patch" ClientPatchDirectory = "T:/client_patch"
try: try:
ClientInstallDirectory ClientInstallDirectory
except NameError: except NameError:
ClientInstallDirectory = "W:/client_install" ClientInstallDirectory = "T:/client_install"
try: try:
ShardInstallDirectory ShardInstallDirectory
except NameError: except NameError:
ShardInstallDirectory = "W:/shard" ShardInstallDirectory = "T:/shard"
try: try:
WorldEditInstallDirectory WorldEditInstallDirectory
except NameError: except NameError:
WorldEditInstallDirectory = "W:/worldedit" WorldEditInstallDirectory = "T:/worldedit"
try: try:
LeveldesignDirectory LeveldesignDirectory
except NameError: except NameError:
@ -178,7 +178,7 @@ if not args.noconf:
try: try:
PatchmanBridgeServerDirectory PatchmanBridgeServerDirectory
except NameError: except NameError:
PatchmanBridgeServerDirectory = "W:/bridge_server" PatchmanBridgeServerDirectory = "T:/bridge_server"
try: try:
MaxAvailable MaxAvailable
except NameError: except NameError:
@ -191,7 +191,11 @@ if not args.noconf:
MaxUserDirectory MaxUserDirectory
except NameError: except NameError:
import os import os
MaxUserDirectory = os.path.normpath(os.environ["LOCALAPPDATA"] + "/Autodesk/3dsMax/2010 - 32bit/enu") try:
MaxUserDirectory = os.path.normpath(os.environ["LOCALAPPDATA"] + "/Autodesk/3dsMax/2010 - 32bit/enu")
except KeyError:
MaxAvailable = 0
MaxUserDirectory = "C:/Users/Kaetemi/AppData/Local/Autodesk/3dsMax/2010 - 32bit/enu"
try: try:
MaxExecutable MaxExecutable
except NameError: except NameError: