1
0
forked from 0ad/0ad

A few log categories

This was SVN commit r994.
This commit is contained in:
Ykkrosh 2004-08-15 20:57:31 +00:00
parent 0037a0c6c0
commit 9cd4cab693
18 changed files with 101 additions and 64 deletions

View File

@ -10,6 +10,8 @@
#include "ps/Xeromyces.h"
#define LOG_CATEGORY "graphics"
CObjectEntry::CObjectEntry(int type) : m_Model(0), m_Type(type)
{
m_IdleAnim=0;
@ -50,7 +52,7 @@ bool CObjectEntry::BuildModel()
try {
modeldef=CModelDef::Load(modelfilename);
} catch (...) {
LOG(ERROR, "CObjectEntry::BuildModel(): Model %s failed to load", modelfilename);
LOG(ERROR, LOG_CATEGORY, "CObjectEntry::BuildModel(): Model %s failed to load", modelfilename);
return false;
}
@ -98,11 +100,11 @@ bool CObjectEntry::BuildModel()
m_Model->AddProp(proppoint,propmodel);
if (oe->m_WalkAnim) propmodel->SetAnimation(oe->m_WalkAnim);
} else {
LOG(ERROR,"Failed to build prop model \"%s\" on actor \"%s\"",(const char*) m_Name,(const char*) prop.m_ModelName);
LOG(ERROR, LOG_CATEGORY, "Failed to build prop model \"%s\" on actor \"%s\"",(const char*) m_Name,(const char*) prop.m_ModelName);
}
}
} else {
LOG(ERROR,"Failed to matching prop point called \"%s\" in model \"%s\"", (const char*)prop.m_PropPointName, modelfilename);
LOG(ERROR, LOG_CATEGORY, "Failed to matching prop point called \"%s\" in model \"%s\"", (const char*)prop.m_PropPointName, modelfilename);
}
}

View File

@ -5,6 +5,8 @@
#include "CLogger.h"
#include "lib/res/res.h"
#define LOG_CATEGORY "graphics"
CObjectManager::CObjectManager() : m_SelectedObject(0)
{
m_ObjectTypes.reserve(32);
@ -104,7 +106,7 @@ void CObjectManager::BuildObjectTypes()
vfs_close_dir(dir);
}
else
LOG(ERROR, "CObjectManager::BuildObjectTypes(): Unable to open dir art/actors/");
LOG(ERROR, LOG_CATEGORY, "CObjectManager::BuildObjectTypes(): Unable to open dir art/actors/");
}
void CObjectManager::LoadObjects(int type)
@ -124,15 +126,15 @@ void CObjectManager::LoadObjects(int type)
CStr filename(pathname);
filename+=dent.name;
if (!object->Load((const char*) filename)) {
LOG(ERROR, "CObjectManager::LoadObjects(): %s: XML Load failed", filename.c_str());
LOG(ERROR, LOG_CATEGORY, "CObjectManager::LoadObjects(): %s: XML Load failed", filename.c_str());
delete object;
} else {
AddObject(object,type);
LOG(NORMAL, "CObjectManager::LoadObjects(): %s: XML Loaded", filename.c_str());
LOG(NORMAL, LOG_CATEGORY, "CObjectManager::LoadObjects(): %s: XML Loaded", filename.c_str());
}
}
vfs_close_dir(dir);
}
else
LOG(ERROR, "CObjectManager::LoadObjects(): Unable to open dir %s.", pathname.c_str());
LOG(ERROR, LOG_CATEGORY, "CObjectManager::LoadObjects(): Unable to open dir %s.", pathname.c_str());
}

View File

@ -14,6 +14,8 @@
#include "SkeletonAnimManager.h"
#include <algorithm>
#define LOG_CATEGORY "graphics"
///////////////////////////////////////////////////////////////////////////////
// CSkeletonAnimManager constructor
CSkeletonAnimManager::CSkeletonAnimManager()
@ -59,12 +61,12 @@ CSkeletonAnimDef* CSkeletonAnimManager::GetAnimation(const char* filename)
}
if (!def) {
LOG(ERROR, "CSkeletonAnimManager::GetAnimation(%s): Failed loading, marked file as bad", filename);
LOG(ERROR, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Failed loading, marked file as bad", filename);
// add this file as bad
m_BadAnimationFiles.insert(fname);
return 0;
} else {
LOG(NORMAL, "CSkeletonAnimManager::GetAnimation(%s): Loaded successfully", filename);
LOG(NORMAL, LOG_CATEGORY, "CSkeletonAnimManager::GetAnimation(%s): Loaded successfully", filename);
// add mapping for this file
m_Animations[fname]=def;
return def;

View File

@ -8,6 +8,7 @@
#include "res/tex.h"
#include "CLogger.h"
#define LOG_CATEGORY "graphics"
static const char* SupportedTextureFormats[] = { ".png", ".dds", ".tga", ".bmp" };
@ -103,7 +104,7 @@ void CTextureManager::LoadTerrainTextures(int terraintype,const char* fileext)
{
while (vfs_next_dirent(dir, &dent, fileext) == 0)
{
LOG(NORMAL, "CTextureManager::LoadTerrainTextures(): texture %s added to type %s", dent.name, m_TerrainTextures[terraintype].m_Name.c_str());
LOG(NORMAL, LOG_CATEGORY, "CTextureManager::LoadTerrainTextures(): texture %s added to type %s", dent.name, m_TerrainTextures[terraintype].m_Name.c_str());
AddTexture(dent.name, terraintype);
}

View File

@ -35,6 +35,9 @@ using namespace std;
#include "ps/CLogger.h"
#define XERO_TIME
#define LOG_CATEGORY "gui"
// Class for global JavaScript object
JSClass GUIClass = {
"GUIClass", 0,
@ -892,13 +895,13 @@ void CGUI::ReportParseError(const CStr& str)
// Print header
if (m_Errors==0)
{
LOG(ERROR, "*** GUI Tree Creation Errors:");
LOG(ERROR, LOG_CATEGORY, "*** GUI Tree Creation Errors:");
}
// Important, set ParseError to true
++m_Errors;
LOG(ERROR, str);
LOG(ERROR, LOG_CATEGORY, str);
}
/**
@ -954,7 +957,7 @@ void CGUI::LoadXMLFile(const string &Filename)
}
catch (PSERROR_GUI)
{
LOG(ERROR, "Errors loading GUI file %s", Filename.c_str());
LOG(ERROR, LOG_CATEGORY, "Errors loading GUI file %s", Filename.c_str());
return;
}
@ -1173,7 +1176,7 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
Handle tex = tex_load(TexFilename.c_str());
if (tex <= 0)
{
LOG(ERROR, "Error opening texture '%s': %lld", TexFilename.c_str(), tex);
LOG(ERROR, LOG_CATEGORY, "Error opening texture '%s': %lld", TexFilename.c_str(), tex);
throw PSERROR_GUI_TextureLoadFailed();
}
image.m_Texture = tex;
@ -1268,7 +1271,7 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
CVFSFile scriptfile;
if (scriptfile.Load(file) != PSRETURN_OK)
{
LOG(ERROR, "Error opening action file '%s'", file.c_str());
LOG(ERROR, LOG_CATEGORY, "Error opening action file '%s'", file.c_str());
throw PSERROR_GUI_JSOpenFailed();
}
@ -1343,7 +1346,7 @@ void CGUI::Xeromyces_ReadScript(XMBElement Element, CXeromyces* pFile)
CVFSFile scriptfile;
if (scriptfile.Load(file) != PSRETURN_OK)
{
LOG(ERROR, "Error opening script file '%s'", file.c_str());
LOG(ERROR, LOG_CATEGORY, "Error opening script file '%s'", file.c_str());
throw PSERROR_GUI_JSOpenFailed();
}
@ -1436,7 +1439,7 @@ void CGUI::Xeromyces_ReadImage(XMBElement Element, CXeromyces* pFile, CGUISprite
Handle tex = tex_load(TexFilename.c_str());
if (tex <= 0)
{
LOG(ERROR, "Error opening texture '%s': %lld", TexFilename.c_str(), tex);
LOG(ERROR, LOG_CATEGORY, "Error opening texture '%s': %lld", TexFilename.c_str(), tex);
throw PSERROR_GUI_TextureLoadFailed();
}
image.m_Texture = tex;

View File

@ -2,8 +2,8 @@
/*
See http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html
for the specification (an extension to ISO C) that was used when creating
this code.
for the specification (apparently an extension to ISO C) that was used
when creating this code.
*/
/*
@ -19,6 +19,8 @@
*m$ <-- positional precision parameters, because they're not worthwhile
portability <-- just use GCC
efficiency <-- nothing in the spec says it should be as fast as possible
(the code could be made a lot faster if speed mattered more
than non-fixed size buffers)
*/

View File

@ -56,6 +56,8 @@
#include "ConfigDB.h"
#include "CLogger.h"
#define LOG_CATEGORY "main"
#ifndef NO_GUI
#include "gui/GUI.h"
#endif
@ -616,7 +618,7 @@ static void ParseArgs(int argc, char* argv[])
if ((val=g_ConfigDB.GetValue(CFG_SYSTEM, "shadows")))
val->GetBool(g_Shadows);
LOG(NORMAL, "g_x/yres is %dx%d", g_xres, g_yres);
LOG(NORMAL, LOG_CATEGORY, "g_x/yres is %dx%d", g_xres, g_yres);
}
@ -778,7 +780,7 @@ PREVTSC=TSC;
// init SDL
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE) < 0)
{
LOG(ERROR, "SDL library initialization failed: %s", SDL_GetError());
LOG(ERROR, LOG_CATEGORY, "SDL library initialization failed: %s", SDL_GetError());
throw PSERROR_System_SDLInitFailed();
}
atexit(SDL_Quit);
@ -828,7 +830,7 @@ sle(11340106);
if(set_vmode(g_xres, g_yres, 32, !windowed) < 0)
{
LOG(ERROR, "Could not set %dx%d graphics mode: %s", g_xres, g_yres, SDL_GetError());
LOG(ERROR, LOG_CATEGORY, "Could not set %dx%d graphics mode: %s", g_xres, g_yres, SDL_GetError());
throw PSERROR_System_VmodeFailed();
}
SDL_WM_SetCaption("0 A.D.", "0 A.D.");
@ -837,7 +839,7 @@ sle(11340106);
if(!oglExtAvail("GL_ARB_multitexture") || !oglExtAvail("GL_ARB_texture_env_combine"))
{
LOG(ERROR, "Required ARB_multitexture or ARB_texture_env_combine extension not available");
LOG(ERROR, LOG_CATEGORY, "Required ARB_multitexture or ARB_texture_env_combine extension not available");
throw PSERROR_System_RequiredExtensionsMissing();
}

View File

@ -6,6 +6,8 @@
#include "lib/res/vfs.h"
#include "ps/CLogger.h"
#define LOG_CATEGORY "file"
CVFSFile::CVFSFile() : m_Handle(0) {}
CVFSFile::~CVFSFile()
@ -25,7 +27,7 @@ PSRETURN CVFSFile::Load(const char* filename, uint flags /* default 0 */)
m_Handle = vfs_load(filename, m_Buffer, m_BufferSize, flags);
if (m_Handle <= 0)
{
LOG(ERROR, "CVFSFile: file %s couldn't be opened (vfs_load: %lld)", filename, m_Handle);
LOG(ERROR, LOG_CATEGORY, "CVFSFile: file %s couldn't be opened (vfs_load: %lld)", filename, m_Handle);
return PSRETURN_CVFSFile_LoadFailed;
}
@ -36,9 +38,11 @@ const void* CVFSFile::GetBuffer() const
{
// Die in a very obvious way, to avoid problems caused by
// accidentally forgetting to check that the open succeeded
assert(m_Handle && "GetBuffer() called with no file loaded");
if (!m_Handle)
{
debug_warn("GetBuffer() called with no file loaded");
throw PSERROR_CVFSFile_InvalidBufferAccess();
}
return m_Buffer;
}
@ -52,9 +56,11 @@ CStr CVFSFile::GetAsString() const
{
// Die in a very obvious way, to avoid subtle problems caused by
// accidentally forgetting to check that the open succeeded
assert(m_Handle && "GetBuffer() called with no file loaded");
if (!m_Handle)
{
debug_warn("GetBuffer() called with no file loaded");
throw PSERROR_CVFSFile_InvalidBufferAccess();
}
return std::string((char*)m_Buffer, m_BufferSize);
}

View File

@ -10,6 +10,8 @@
#include "scripting/ScriptingHost.h"
#include "types.h"
#define LOG_CATEGORY "config"
using namespace std;
typedef map <CStr, CConfigValueSet> TConfigMap;
@ -255,7 +257,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
fh=vfs_load(m_ConfigFile[ns], buffer, buflen);
if (fh <= 0)
{
LOG(ERROR, "vfs_load for \"%s\" failed: return was %lld", m_ConfigFile[ns].c_str(), fh);
LOG(ERROR, LOG_CATEGORY, "vfs_load for \"%s\" failed: return was %lld", m_ConfigFile[ns].c_str(), fh);
return false;
}
}
@ -263,12 +265,12 @@ bool CConfigDB::Reload(EConfigNamespace ns)
{
if (file_open(m_ConfigFile[ns], 0, &f)!=0)
{
LOG(ERROR, "file_open for \"%s\" failed", m_ConfigFile[ns].c_str());
LOG(ERROR, LOG_CATEGORY, "file_open for \"%s\" failed", m_ConfigFile[ns].c_str());
return false;
}
if (file_map(&f, buffer, buflen) != 0)
{
LOG(ERROR, "file_map for \"%s\" failed", m_ConfigFile[ns].c_str());
LOG(ERROR, LOG_CATEGORY, "file_map for \"%s\" failed", m_ConfigFile[ns].c_str());
return false;
}
}
@ -311,7 +313,7 @@ bool CConfigDB::Reload(EConfigNamespace ns)
CConfigValue argument;
argument.m_String = value;
newMap[name].push_back( argument );
LOG(NORMAL, "Loaded config string \"%s\" = \"%s\"", name.c_str(), value.c_str());
LOG(NORMAL, LOG_CATEGORY, "Loaded config string \"%s\" = \"%s\"", name.c_str(), value.c_str());
}
}
}
@ -347,7 +349,7 @@ bool CConfigDB::WriteFile(EConfigNamespace ns, bool useVFS, CStr path)
{
if ((err=vfs_realpath(filepath, realpath))!=0)
{
LOG(ERROR, "CConfigDB::WriteFile(): vfs_realpath for VFS path \"%s\" failed (error: %d)", filepath, err);
LOG(ERROR, LOG_CATEGORY, "CConfigDB::WriteFile(): vfs_realpath for VFS path \"%s\" failed (error: %d)", filepath, err);
return false;
}
filepath=realpath;
@ -355,7 +357,7 @@ bool CConfigDB::WriteFile(EConfigNamespace ns, bool useVFS, CStr path)
file_make_native_path(filepath, nativepath);
if ((fp = fopen(nativepath, "w")) == NULL)
{
LOG(ERROR, "CConfigDB::WriteFile(): fopen for path \"%s\" failed (error: %d)", filepath, errno);
LOG(ERROR, LOG_CATEGORY, "CConfigDB::WriteFile(): fopen for path \"%s\" failed (error: %d)", filepath, errno);
return false;
}

View File

@ -12,6 +12,8 @@
#include "BaseEntityCollection.h"
#include "EntityManager.h"
#define LOG_CATEGORY "world"
extern CLightEnv g_LightEnv;
void CWorld::Initialize(CGameAttributes *pAttribs)
@ -24,7 +26,7 @@ void CWorld::Initialize(CGameAttributes *pAttribs)
CMapReader reader;
reader.LoadMap(mapfilename, &m_Terrain, &m_UnitManager, &g_LightEnv);
} catch (...) {
LOG(ERROR, "Failed to load map %s", mapfilename.c_str());
LOG(ERROR, LOG_CATEGORY, "Failed to load map %s", mapfilename.c_str());
throw PSERROR_Game_World_MapLoadFailed();
}
}

View File

@ -10,6 +10,8 @@
#include "res/vfs.h"
#define LOG_CATEGORY "xml"
/*
// but static Xerces => tons of warnings due to missing debug info,
// and warnings about invalid pointers (conflicting CRT heaps?) in parser => allow for now
@ -56,14 +58,14 @@ int CVFSInputSource::OpenFile(const char *path)
m_hFile=vfs_open(path);
if (m_hFile <= 0)
{
LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_open: %lld)", path, m_hFile);
LOG(ERROR, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be opened (vfs_open: %lld)", path, m_hFile);
return -1;
}
int err;
if ((err=vfs_map(m_hFile, 0, m_pBuffer, m_BufferSize)) != 0)
{
LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_map: %d)", path, err);
LOG(ERROR, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be opened (vfs_map: %d)", path, err);
vfs_close(m_hFile);
m_hFile=0;
return -1;
@ -166,12 +168,12 @@ InputSource *CVFSEntityResolver::resolveEntity(const XMLCh *const UNUSEDPARAM(pu
path=abspath;
}
LOG(NORMAL, "EntityResolver: path \"%s\" translated to \"%s\"", orgpath, path);
LOG(NORMAL, LOG_CATEGORY, "EntityResolver: path \"%s\" translated to \"%s\"", orgpath, path);
char *pos=path;
if ((pos=strchr(pos, '\\')) != NULL)
{
LOG(WARNING, "While resolving XML entities for %s: path %s [%s] contains non-portable path separator \\", m_DocName, orgpath, path);
LOG(WARNING, LOG_CATEGORY, "While resolving XML entities for %s: path %s [%s] contains non-portable path separator \\", m_DocName, orgpath, path);
do
*pos='/';
while ((pos=strchr(pos+1, '\\')) != NULL);

View File

@ -17,6 +17,8 @@ gee@pyro.nu
#include "Prometheus.h"
#include "CLogger.h"
#define LOG_CATEGORY "xml"
// Use namespace
XERCES_CPP_NAMESPACE_USE
@ -25,7 +27,7 @@ void CXercesErrorHandler::warning(const SAXParseException &toCatch)
CStr systemId=XMLTranscode(toCatch.getSystemId());
CStr message=XMLTranscode(toCatch.getMessage());
LOG(WARNING, "XML Parse Warning: %s:%d:%d: %s",
LOG(WARNING, LOG_CATEGORY, "XML Parse Warning: %s:%d:%d: %s",
systemId.c_str(),
toCatch.getLineNumber(),
toCatch.getColumnNumber(),
@ -38,7 +40,7 @@ void CXercesErrorHandler::error(const SAXParseException& toCatch)
CStr message=XMLTranscode(toCatch.getMessage());
fSawErrors = true;
LOG(ERROR, "XML Parse Error: %s:%d:%d: %s",
LOG(ERROR, LOG_CATEGORY, "XML Parse Error: %s:%d:%d: %s",
systemId.c_str(),
toCatch.getLineNumber(),
toCatch.getColumnNumber(),
@ -51,7 +53,7 @@ void CXercesErrorHandler::fatalError(const SAXParseException& toCatch)
CStr message=XMLTranscode(toCatch.getMessage());
fSawErrors = true;
LOG(ERROR, "XML Parse Error (Fatal): %s:%d:%d: %s",
LOG(ERROR, LOG_CATEGORY, "XML Parse Error (Fatal): %s:%d:%d: %s",
systemId.c_str(),
toCatch.getLineNumber(),
toCatch.getColumnNumber(),

View File

@ -1,4 +1,4 @@
// $Id: Xeromyces.cpp,v 1.12 2004/08/03 10:17:08 philip Exp $
// $Id: Xeromyces.cpp,v 1.13 2004/08/15 20:57:31 philip Exp $
#include "precompiled.h"
@ -12,6 +12,8 @@
#include "ps/CLogger.h"
#include "lib/res/vfs.h"
#define LOG_CATEGORY "xml"
// Because I (and Xerces) don't like these being redefined by wposix.h:
#ifdef HAVE_PCH
# undef read
@ -193,7 +195,7 @@ PSRETURN CXeromyces::Load(const char* filename)
CVFSFile file;
if (file.Load(filename) != PSRETURN_OK)
{
LOG(ERROR, "CXeromyces: XML open of %s failed", filename);
LOG(ERROR, LOG_CATEGORY, "CXeromyces: XML open of %s failed", filename);
return PSRETURN_Xeromyces_XMLOpenFailed;
}
@ -263,7 +265,7 @@ PSRETURN CXeromyces::Load(const char* filename)
if (errorHandler.getSawErrors())
{
LOG(ERROR, "CXeromyces: Errors in XML file '%s'", filename);
LOG(ERROR, LOG_CATEGORY, "CXeromyces: Errors in XML file '%s'", filename);
return PSRETURN_Xeromyces_XMLParseError;
// The internal tree of the XeroHandler will be cleaned up automatically
}

View File

@ -34,6 +34,8 @@
#include "res/mem.h"
#include "res/tex.h"
#define LOG_CATEGORY "graphics"
struct TGAHeader {
// header stuff
unsigned char iif_size;
@ -168,11 +170,11 @@ bool CRenderer::Open(int width, int height, int depth)
GLint bits;
glGetIntegerv(GL_DEPTH_BITS,&bits);
LOG(NORMAL,"CRenderer::Open: depth bits %d",bits);
LOG(NORMAL, LOG_CATEGORY, "CRenderer::Open: depth bits %d",bits);
glGetIntegerv(GL_STENCIL_BITS,&bits);
LOG(NORMAL,"CRenderer::Open: stencil bits %d",bits);
LOG(NORMAL, LOG_CATEGORY, "CRenderer::Open: stencil bits %d",bits);
glGetIntegerv(GL_ALPHA_BITS,&bits);
LOG(NORMAL,"CRenderer::Open: alpha bits %d",bits);
LOG(NORMAL, LOG_CATEGORY, "CRenderer::Open: alpha bits %d",bits);
return true;
}
@ -933,7 +935,7 @@ void CRenderer::EndFrame()
static bool once=false;
if (!once && glGetError()) {
LOG(ERROR,"CRenderer::EndFrame: GL errors occurred");
LOG(ERROR, LOG_CATEGORY, "CRenderer::EndFrame: GL errors occurred");
once=true;
}
}
@ -1027,7 +1029,7 @@ bool CRenderer::LoadTexture(CTexture* texture,u32 wrapflags)
} else {
h=tex_load(texture->GetName());
if (!h) {
LOG(ERROR,"LoadTexture failed on \"%s\"",(const char*) texture->GetName());
LOG(ERROR, LOG_CATEGORY, "LoadTexture failed on \"%s\"",(const char*) texture->GetName());
texture->SetHandle(0xffffffff);
return false;
} else {
@ -1038,7 +1040,7 @@ bool CRenderer::LoadTexture(CTexture* texture,u32 wrapflags)
th&=(th-1);
if (tw || th) {
texture->SetHandle(0xffffffff);
LOG(ERROR,"LoadTexture failed on \"%s\" : not a power of 2 texture",(const char*) texture->GetName());
LOG(ERROR, LOG_CATEGORY, "LoadTexture failed on \"%s\" : not a power of 2 texture",(const char*) texture->GetName());
return false;
} else {
BindTexture(0,tex_id(h));

View File

@ -11,6 +11,8 @@
#include "VertexBufferManager.h"
#include "ps/CLogger.h"
#define LOG_CATEGORY "graphics"
CVertexBufferManager g_VBMan;
// janwas 2004-06-14: added dtor
@ -53,7 +55,7 @@ CVertexBuffer::VBChunk* CVertexBufferManager::Allocate(size_t vertexSize,size_t
// VBO case" better
if (!result)
{
LOG(ERROR, "Failed to create VBOs");
LOG(ERROR, LOG_CATEGORY, "Failed to create VBOs");
assert2(!"Failed to create VBOs");
}

View File

@ -1,8 +1,8 @@
#include "precompiled.h"
#include "ScriptGlue.h"
#include "CConsole.h"
#include "CLogger.h"
#include "CConsole.h"
#include "CStr.h"
#include "EntityHandles.h"
#include "Entity.h"
@ -89,7 +89,7 @@ JSBool WriteLog(JSContext* context, JSObject* UNUSEDPARAM(globalObject), unsigne
// We should perhaps unicodify (?) the logger at some point.
LOG( NORMAL, logMessage );
LOG( NORMAL, "script", logMessage );
return JS_TRUE;
}
@ -304,11 +304,11 @@ JSBool js_mem(JSContext* UNUSEDPARAM(context), JSObject* UNUSEDPARAM(globalObjec
int left, total;
extern int GetVRAMInfo(int&, int&);
if (GetVRAMInfo(left, total))
LOG(WARNING, "VRAM: used %d, total %d, free %d", total-left, total, left);
g_Console->InsertMessage(L"VRAM: used %d, total %d, free %d", total-left, total, left);
else
LOG(WARNING, "VRAM: failed to detect");
g_Console->InsertMessage(L"VRAM: failed to detect");
#else
LOG(WARNING, "VRAM: [not available on non-Windows]");
g_Console->InsertMessage(L"VRAM: [not available on non-Windows]");
#endif
return JS_TRUE;
}

View File

@ -5,6 +5,8 @@
#include "Model.h"
#include "CLogger.h"
#define LOG_CATEGORY "entity"
void CBaseEntityCollection::loadTemplates()
{
Handle handle;
@ -35,23 +37,23 @@ void CBaseEntityCollection::loadTemplates()
if( newTemplate->loadXML( pathname + file.name ) )
{
addTemplate( newTemplate );
LOG(NORMAL, "CBaseEntityCollection::loadTemplates(): Loaded template \"%s%s\"", pathname.c_str(), file.name);
LOG(NORMAL, LOG_CATEGORY, "CBaseEntityCollection::loadTemplates(): Loaded template \"%s%s\"", pathname.c_str(), file.name);
}
else
LOG(ERROR, "CBaseEntityCollection::loadTemplates(): Couldn't load template \"%s%s\"", pathname.c_str(), file.name);
LOG(ERROR, LOG_CATEGORY, "CBaseEntityCollection::loadTemplates(): Couldn't load template \"%s%s\"", pathname.c_str(), file.name);
}
vfs_close_dir( handle );
}
else
{
LOG(ERROR, "CBaseEntityCollection::loadTemplates(): Failed to enumerate entity template directory");
LOG(ERROR, LOG_CATEGORY, "CBaseEntityCollection::loadTemplates(): Failed to enumerate entity template directory");
return;
}
}
vfs_close_dir( maindir );
}
else
LOG(ERROR, "CBaseEntityCollection::loadTemplates(): Unable to open directory entities/");
LOG(ERROR, LOG_CATEGORY, "CBaseEntityCollection::loadTemplates(): Unable to open directory entities/");
}
void CBaseEntityCollection::addTemplate( CBaseEntity* temp )

View File

@ -16,6 +16,7 @@
# endif
#endif
#define LOG_CATEGORY "audio"
#include "res/res.h"
@ -127,11 +128,11 @@ void CMusicPlayer::open(char *filename)
size_t sizeOfFile;
if(vfs_load(filename, p, sizeOfFile) <= 0)
{
LOG(ERROR, "CMusicPlayer::open(): vfs_load for %s failed!\n", filename);
LOG(ERROR, LOG_CATEGORY, "CMusicPlayer::open(): vfs_load for %s failed!\n", filename);
return;
}
else
LOG(NORMAL, "CMusicPlayer::open(): file %s loaded successfully\n", filename);
LOG(NORMAL, LOG_CATEGORY, "CMusicPlayer::open(): file %s loaded successfully\n", filename);
memFile.dataPtr = (char*)p;
memFile.dataRead = 0;
@ -147,7 +148,7 @@ void CMusicPlayer::open(char *filename)
//start file to from memory
if (ov_open_callbacks(&memFile, &oggStream, NULL, 0, vorbisCallbacks) != 0)
{
LOG(ERROR, "Could not decode ogg into memory\n");
LOG(ERROR, LOG_CATEGORY, "Could not decode ogg into memory\n");
return;
}
@ -300,7 +301,7 @@ void CMusicPlayer::check()
if(error != AL_NO_ERROR)
{
std::string str = errorString(error);
LOG(ERROR, "OpenAL error: %s\n", str.c_str());
LOG(ERROR, LOG_CATEGORY, "OpenAL error: %s\n", str.c_str());
}
}
@ -336,7 +337,7 @@ bool CMusicPlayer::stream(ALuint buffer)
// error
else if(ret < 0)
{
LOG(ERROR, "Error reading from ogg file: %s\n", errorString(ret).c_str());
LOG(ERROR, LOG_CATEGORY, "Error reading from ogg file: %s\n", errorString(ret).c_str());
return false;
}
// EOF