Merge pull request #460 from GangZhuo/master

Conditional compile
This commit is contained in:
Gang Zhuo
2016-03-02 16:27:04 +08:00
+4 -6
View File
@@ -2,6 +2,7 @@
using System.IO;
using System.Net.Sockets;
using System.Net;
using System.Diagnostics;
using Shadowsocks.Util;
@@ -47,16 +48,15 @@ namespace Shadowsocks.Controller
WriteToLogFile(o);
}
[Conditional("DEBUG")]
public static void Debug(object o)
{
#if DEBUG
WriteToLogFile("[D] " + o);
#endif
}
[Conditional("DEBUG")]
public static void Debug(EndPoint local, EndPoint remote, int len, string header = null, string tailer = null)
{
#if DEBUG
if (header == null && tailer == null)
Debug($"{local} => {remote} (size={len})");
else if (header == null && tailer != null)
@@ -65,14 +65,12 @@ namespace Shadowsocks.Controller
Debug($"{header}: {local} => {remote} (size={len})");
else
Debug($"{header}: {local} => {remote} (size={len}), {tailer}");
#endif
}
[Conditional("DEBUG")]
public static void Debug(Socket sock, int len, string header = null, string tailer = null)
{
#if DEBUG
Debug(sock.LocalEndPoint, sock.RemoteEndPoint, len, header, tailer);
#endif
}
public static void LogUsefulException(Exception e)