From a486514afb34d8045e714632f014399e45814a1b Mon Sep 17 00:00:00 2001 From: Gang Zhuo Date: Wed, 2 Mar 2016 02:56:41 -0500 Subject: [PATCH] Conditional compile --- shadowsocks-csharp/Controller/Logging.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/shadowsocks-csharp/Controller/Logging.cs b/shadowsocks-csharp/Controller/Logging.cs index 803b0c08..f86dfe2e 100755 --- a/shadowsocks-csharp/Controller/Logging.cs +++ b/shadowsocks-csharp/Controller/Logging.cs @@ -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)