Cavestory Mod API
Macros | Functions
Logging

Printing to the console. More...

Macros

#define CSM_LogError(pCategory, pFormat, ...)   CSM_LogInfo(pCategory, "\v08" pFormat, __VA_ARGS__)
 Log an error message to the console & to the log file (if one is open). More...
 
#define CSM_LogWarn(pCategory, pFormat, ...)   CSM_LogInfo(pCategory, "\v0B" pFormat, __VA_ARGS__)
 Log a warning message to the console & to the log file (if one is open). More...
 
#define CSM_LogErrorWithInfo(pCategory, pFormat, ...)   __CSM__LogError(__FILE__, __LINE__, pCategory, pFormat, __VA_ARGS__)
 Log an error message to the console & to the log file (if one is open). More...
 
#define CSM_LogWarnWithInfo(pCategory, pFormat, ...)   __CSM__LogWarn(__FILE__, __LINE__, pCategory, pFormat, __VA_ARGS__)
 Log a warning message to the console & to the log file (if one is open). More...
 

Functions

CAVESTORY_MOD_API void CSM_Log_EnableStackLines (bool bEnable)
 Enable or disable StackLines. More...
 
CAVESTORY_MOD_API void CSM_Log (const char *pFormat,...)
 Log a message to the console. More...
 
CAVESTORY_MOD_API void CSM_LogInfo (const char *pCategory, const char *pFormat,...)
 Log a message to the console & to the log file (if one is open). More...
 
CAVESTORY_MOD_API void CSM_LogColor (unsigned int iColor=0xFFFFFFFF)
 Set the color of the console. More...
 
CAVESTORY_MOD_API void __CSM__LogError (const char *pSourceFile, int iSourceLineNo, const char *pCategory, const char *pFormat,...)
 Log an error message to the console & to the log file (if one is open). More...
 
CAVESTORY_MOD_API void __CSM__LogWarn (const char *pSourceFile, int iSourceLineNo, const char *pCategory, const char *pFormat,...)
 Log a warning message to the console & to the log file (if one is open). More...
 
CAVESTORY_MOD_API void CSM_LogInfoNoNL (const char *pCategory, const char *pFormat,...)
 Log a message to the console & to the log file (if one is open). More...
 
CAVESTORY_MOD_API void CSM_Explode (int iErrorCode, const char *pErrorName, const char *pTitle="\\a{0} crashed!", const char *pMessage="The mod's DLL has crashed!", bool bGenerateCrashLog=true)
 Display a crash screen. More...
 

Detailed Description

Printing to the console.

Functions to print to the console with.

Macro Definition Documentation

◆ CSM_LogError

#define CSM_LogError (   pCategory,
  pFormat,
  ... 
)    CSM_LogInfo(pCategory, "\v08" pFormat, __VA_ARGS__)

Log an error message to the console & to the log file (if one is open).

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.
Examples
RenderPipeline.cpp.

◆ CSM_LogErrorWithInfo

#define CSM_LogErrorWithInfo (   pCategory,
  pFormat,
  ... 
)    __CSM__LogError(__FILE__, __LINE__, pCategory, pFormat, __VA_ARGS__)

Log an error message to the console & to the log file (if one is open).

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.

◆ CSM_LogWarn

#define CSM_LogWarn (   pCategory,
  pFormat,
  ... 
)    CSM_LogInfo(pCategory, "\v0B" pFormat, __VA_ARGS__)

Log a warning message to the console & to the log file (if one is open).

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.

◆ CSM_LogWarnWithInfo

#define CSM_LogWarnWithInfo (   pCategory,
  pFormat,
  ... 
)    __CSM__LogWarn(__FILE__, __LINE__, pCategory, pFormat, __VA_ARGS__)

Log a warning message to the console & to the log file (if one is open).

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.

Function Documentation

◆ __CSM__LogError()

CAVESTORY_MOD_API void __CSM__LogError ( const char *  pSourceFile,
int  iSourceLineNo,
const char *  pCategory,
const char *  pFormat,
  ... 
)

Log an error message to the console & to the log file (if one is open).

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.

◆ __CSM__LogWarn()

CAVESTORY_MOD_API void __CSM__LogWarn ( const char *  pSourceFile,
int  iSourceLineNo,
const char *  pCategory,
const char *  pFormat,
  ... 
)

Log a warning message to the console & to the log file (if one is open).

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.

◆ CSM_Explode()

CAVESTORY_MOD_API void CSM_Explode ( int  iErrorCode,
const char *  pErrorName,
const char *  pTitle = "\\a{0} crashed!",
const char *  pMessage = "The mod's DLL has crashed!",
bool  bGenerateCrashLog = true 
)

Display a crash screen.

Parameters
iErrorCodeThe error code to display alongside the error name.
pErrorNameThe name of the error (Ex. "MY_MOD_COULDNT_FIND_NPC"; Can be whatever you want). Max limit 32 characters.
pTitleThe title message of the crash window. Can be a locale string (just start it with '#'). Uses the mod name as the first argument.
pMessageThe crash message to be included with everything else. New lines are supported. Can be a locale string (just start it with '#').
bGenerateCrashLogWhether or not to generate a crash log.
Note
This sets your DLL to be unloaded the next main-thread game tick.

◆ CSM_Log()

CAVESTORY_MOD_API void CSM_Log ( const char *  pFormat,
  ... 
)

Log a message to the console.

Parameters
pFormatThe format of the string.
...Extra formatting arguments.

◆ CSM_Log_EnableStackLines()

CAVESTORY_MOD_API void CSM_Log_EnableStackLines ( bool  bEnable)

Enable or disable StackLines.

If this is enabled and CSM_LogInfo is called with the same exact message more than twice in a row, it will not re-echo it.

Parameters
bEnableWhether to enable or disable this feature.

◆ CSM_LogColor()

CAVESTORY_MOD_API void CSM_LogColor ( unsigned int  iColor = 0xFFFFFFFF)

Set the color of the console.

Parameters
iColorThe color to set.

◆ CSM_LogInfo()

CAVESTORY_MOD_API void CSM_LogInfo ( const char *  pCategory,
const char *  pFormat,
  ... 
)

Log a message to the console & to the log file (if one is open).

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.

◆ CSM_LogInfoNoNL()

CAVESTORY_MOD_API void CSM_LogInfoNoNL ( const char *  pCategory,
const char *  pFormat,
  ... 
)

Log a message to the console & to the log file (if one is open).

No new line.

Parameters
pCategoryThe category of the log message.
pFormatThe format of the string.
...Extra formatting arguments.