Fix Debug output

DebugHelper is useless, bacuase the return statement is always executed before the actual code.
This commit is contained in:
bao-qian 2015-10-31 18:06:57 +00:00
parent a6f8eb28f2
commit 9d9400f4d9
9 changed files with 12 additions and 23 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using Wox.Infrastructure; using Wox.Infrastructure;
@ -15,7 +16,7 @@ namespace Wox.Plugin.Program
if (watchedPath.Contains(path)) return; if (watchedPath.Contains(path)) return;
if (!Directory.Exists(path)) if (!Directory.Exists(path))
{ {
DebugHelper.WriteLine(string.Format("FileChangeWatcher: {0} doesn't exist", path)); Debug.WriteLine(string.Format("FileChangeWatcher: {0} doesn't exist", path));
return; return;
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -74,7 +75,7 @@ namespace Wox.Plugin.Program
{ {
programs = ProgramCacheStorage.Instance.Programs; programs = ProgramCacheStorage.Instance.Programs;
} }
DebugHelper.WriteLine(string.Format("Preload {0} programs from cache", programs.Count)); Debug.WriteLine(string.Format("Preload {0} programs from cache", programs.Count));
using (new Timeit("Program Index")) using (new Timeit("Program Index"))
{ {
IndexPrograms(); IndexPrograms();

View File

@ -99,7 +99,7 @@ namespace Wox.Core.Plugin
API = API API = API
}); });
sw.Stop(); sw.Stop();
DebugHelper.WriteLine(string.Format("Plugin init:{0} - {1}", pair.Metadata.Name, sw.ElapsedMilliseconds)); Debug.WriteLine(string.Format("Plugin init:{0} - {1}", pair.Metadata.Name, sw.ElapsedMilliseconds));
pair.InitTime = sw.ElapsedMilliseconds; pair.InitTime = sw.ElapsedMilliseconds;
InternationalizationManager.Instance.UpdatePluginMetadataTranslations(pair); InternationalizationManager.Instance.UpdatePluginMetadataTranslations(pair);
}); });
@ -196,7 +196,7 @@ namespace Wox.Core.Plugin
o.PluginID = pair.Metadata.ID; o.PluginID = pair.Metadata.ID;
}); });
sw.Stop(); sw.Stop();
DebugHelper.WriteLine(string.Format("Plugin query: {0} - {1}", pair.Metadata.Name, sw.ElapsedMilliseconds)); Debug.WriteLine(string.Format("Plugin query: {0} - {1}", pair.Metadata.Name, sw.ElapsedMilliseconds));
pair.QueryCount += 1; pair.QueryCount += 1;
if (pair.QueryCount == 1) if (pair.QueryCount == 1)
{ {

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using Wox.Core.UserSettings; using Wox.Core.UserSettings;
@ -24,7 +25,7 @@ namespace Wox.Core.Plugin.QueryDispatcher
PluginPair localPair = pair; PluginPair localPair = pair;
if (query.IsIntantQuery && PluginManager.IsInstantSearchPlugin(pair.Metadata)) if (query.IsIntantQuery && PluginManager.IsInstantSearchPlugin(pair.Metadata))
{ {
DebugHelper.WriteLine(string.Format("Plugin {0} is executing instant search.", pair.Metadata.Name)); Debug.WriteLine(string.Format("Plugin {0} is executing instant search.", pair.Metadata.Name));
using (new Timeit(" => instant search took: ")) using (new Timeit(" => instant search took: "))
{ {
PluginManager.ExecutePluginQuery(localPair, query); PluginManager.ExecutePluginQuery(localPair, query);

View File

@ -1,13 +0,0 @@
using System.Diagnostics;
namespace Wox.Infrastructure
{
public static class DebugHelper
{
public static void WriteLine(string msg)
{
return;
Debug.WriteLine(msg);
}
}
}

View File

@ -17,7 +17,7 @@ namespace Wox.Infrastructure
public void Dispose() public void Dispose()
{ {
stopwatch.Stop(); stopwatch.Stop();
DebugHelper.WriteLine(name + ":" + stopwatch.ElapsedMilliseconds + "ms"); Debug.WriteLine(name + ":" + stopwatch.ElapsedMilliseconds + "ms");
} }
} }
} }

View File

@ -49,7 +49,6 @@
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="DebugHelper.cs" />
<Compile Include="Hotkey\InterceptKeys.cs" /> <Compile Include="Hotkey\InterceptKeys.cs" />
<Compile Include="Hotkey\KeyEvent.cs" /> <Compile Include="Hotkey\KeyEvent.cs" />
<Compile Include="Logger\Log.cs" /> <Compile Include="Logger\Log.cs" />

View File

@ -122,7 +122,7 @@ namespace Wox.ImageLoader
} }
sw.Stop(); sw.Stop();
DebugHelper.WriteLine(string.Format("Loading image path: {0} - {1}ms",path,sw.ElapsedMilliseconds)); Debug.WriteLine(string.Format("Loading image path: {0} - {1}ms",path,sw.ElapsedMilliseconds));
return img; return img;
} }

View File

@ -491,11 +491,11 @@ namespace Wox
{ {
if (!string.IsNullOrEmpty(query) && PluginManager.IsInstantQuery(query)) if (!string.IsNullOrEmpty(query) && PluginManager.IsInstantQuery(query))
{ {
DebugHelper.WriteLine("execute query without delay"); Debug.WriteLine("execute query without delay");
return 0; return 0;
} }
DebugHelper.WriteLine("execute query with 200ms delay"); Debug.WriteLine("execute query with 200ms delay");
return 200; return 200;
} }