DEBUG preprocessor checks for ILog

This commit is contained in:
White 2015-04-08 20:46:12 +09:30
parent 371beb8c52
commit fc1d188951
6 changed files with 16 additions and 2 deletions

View file

@ -2469,7 +2469,9 @@ namespace TShockAPI
{ {
if (type == 100 || type == 164 || type == 180 || type == 261 || (type > 289 && type < 298) || (type >= 325 && type <= 328) || (type >= 345 && type <= 352)) if (type == 100 || type == 164 || type == 180 || type == 261 || (type > 289 && type < 298) || (type >= 325 && type <= 328) || (type >= 345 && type <= 352))
{ {
#if DEBUG
TShock.Log.Debug("Certain projectiles have been ignored for cheat detection."); TShock.Log.Debug("Certain projectiles have been ignored for cheat detection.");
#endif
} }
else else
{ {
@ -2496,7 +2498,9 @@ namespace TShockAPI
{ {
if (type == 90 && TShock.Config.ProjIgnoreShrapnel) // Ignore crystal shards if (type == 90 && TShock.Config.ProjIgnoreShrapnel) // Ignore crystal shards
{ {
#if DEBUG
TShock.Log.Debug("Ignoring shrapnel per config.."); TShock.Log.Debug("Ignoring shrapnel per config..");
#endif
} }
else if (!Main.projectile[index].active) else if (!Main.projectile[index].active)
{ {

View file

@ -122,6 +122,7 @@ namespace TShockAPI
/// <param name="level">LogLevel assosciated with the message</param> /// <param name="level">LogLevel assosciated with the message</param>
void Write(string message, TraceLevel level); void Write(string message, TraceLevel level);
#if DEBUG
/// <summary> /// <summary>
/// Writes a debug string to the log file. /// Writes a debug string to the log file.
/// </summary> /// </summary>
@ -134,6 +135,7 @@ namespace TShockAPI
/// <param name="format">The format of the message to be written.</param> /// <param name="format">The format of the message to be written.</param>
/// <param name="args">The format arguments.</param> /// <param name="args">The format arguments.</param>
void Debug(string format, params object[] args); void Debug(string format, params object[] args);
#endif
/// <summary> /// <summary>
/// Dispose the Log /// Dispose the Log

View file

@ -154,7 +154,8 @@ namespace TShockAPI
{ {
ConsoleInfo(string.Format(format, args)); ConsoleInfo(string.Format(format, args));
} }
#if DEBUG
/// <summary> /// <summary>
/// Writes a debug string to the log file. /// Writes a debug string to the log file.
/// </summary> /// </summary>
@ -175,6 +176,7 @@ namespace TShockAPI
{ {
Debug(string.Format(format, args)); Debug(string.Format(format, args));
} }
#endif
/// <summary> /// <summary>
/// Internal method which writes a message directly to the log file. /// Internal method which writes a message directly to the log file.

View file

@ -205,6 +205,7 @@ namespace TShockAPI
ConsoleInfo(string.Format(format, args)); ConsoleInfo(string.Format(format, args));
} }
#if DEBUG
/// <summary> /// <summary>
/// Writes a debug string to the log file. /// Writes a debug string to the log file.
/// </summary> /// </summary>
@ -223,6 +224,7 @@ namespace TShockAPI
{ {
Debug(string.Format(format, args)); Debug(string.Format(format, args));
} }
#endif
public void Write(string message, TraceLevel level) public void Write(string message, TraceLevel level)
{ {

View file

@ -849,7 +849,7 @@ namespace TShockAPI
{ {
if (displayConsole) if (displayConsole)
{ {
TShock.Log.ConsoleInfo("Player {0} has been disabled for {1}.", Name, reason); TShock.Log.ConsoleInfo("Player {0} has been disabled for {1}.", Name, reason);
} }
else else
{ {
@ -858,11 +858,13 @@ namespace TShockAPI
LastDisableNotification = DateTime.UtcNow; LastDisableNotification = DateTime.UtcNow;
} }
} }
#if DEBUG
var trace = new StackTrace(); var trace = new StackTrace();
StackFrame frame = null; StackFrame frame = null;
frame = trace.GetFrame(1); frame = trace.GetFrame(1);
if (frame != null && frame.GetMethod().DeclaringType != null) if (frame != null && frame.GetMethod().DeclaringType != null)
TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable()."); TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable().");
#endif
} }
public virtual void Whoopie(object time) public virtual void Whoopie(object time)

View file

@ -172,6 +172,7 @@ namespace TShockAPI
ConsoleInfo(string.Format(format, args)); ConsoleInfo(string.Format(format, args));
} }
#if DEBUG
/// <summary> /// <summary>
/// Writes a debug string to the log file. /// Writes a debug string to the log file.
/// </summary> /// </summary>
@ -190,6 +191,7 @@ namespace TShockAPI
{ {
Debug(string.Format(format, args)); Debug(string.Format(format, args));
} }
#endif
/// <summary> /// <summary>
/// Writes a message to the log /// Writes a message to the log