Permalink
Browse files

use string resources for LogStream and update XmlSettings

  • Loading branch information...
suwatch committed Dec 12, 2012
1 parent c3d382a commit e4a82eb5a5dd808cc380d809cf5ea33e4b39c4ae
@@ -49,8 +49,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
- <Reference Include="XmlSettings">
- <HintPath>..\packages\XmlSettings.0.1.2.0\lib\net40\XmlSettings.dll</HintPath>
+ <Reference Include="XmlSettings, Version=0.1.3.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\XmlSettings.0.1.3\lib\net40\XmlSettings.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.IO.Abstractions" version="1.4.0.35" targetFramework="net40" />
- <package id="XmlSettings" version="0.1.2.0" targetFramework="net40" />
+ <package id="XmlSettings" version="0.1.3" targetFramework="net40" />
</packages>
@@ -47,9 +47,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
- <Reference Include="XmlSettings, Version=0.1.2.0, Culture=neutral, processorArchitecture=MSIL">
+ <Reference Include="XmlSettings, Version=0.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\XmlSettings.0.1.2.0\lib\net40\XmlSettings.dll</HintPath>
+ <HintPath>..\packages\XmlSettings.0.1.3\lib\net40\XmlSettings.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="System.IO.Abstractions" version="1.4.0.35" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.9" targetFramework="net40" />
- <package id="XmlSettings" version="0.1.2.0" targetFramework="net40" />
+ <package id="System.IO.Abstractions" version="1.4.0.35" targetFramework="net40" />
+ <package id="XmlSettings" version="0.1.3" targetFramework="net40" />
</packages>
@@ -145,9 +145,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\WebActivator.1.5.1\lib\net40\WebActivator.dll</HintPath>
</Reference>
- <Reference Include="XmlSettings, Version=0.1.2.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\XmlSettings.0.1.2.0\lib\net40\XmlSettings.dll</HintPath>
+ <Reference Include="XmlSettings, Version=0.1.3.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\XmlSettings.0.1.3\lib\net40\XmlSettings.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -18,5 +18,5 @@
<package id="System.IO.Abstractions" version="1.4.0.35" targetFramework="net40" />
<package id="System.Spatial" version="5.0.2" targetFramework="net40" />
<package id="WebActivator" version="1.5.1" targetFramework="net40" />
- <package id="XmlSettings" version="0.1.2.0" targetFramework="net40" />
+ <package id="XmlSettings" version="0.1.3" targetFramework="net40" />
</packages>
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
@@ -13,11 +14,6 @@ namespace Kudu.Services.Performance
{
public class LogStreamManager
{
- private const string InitialMessage = "{0} Welcome, you are now connected to log-streaming service.";
- private const string HeartbeatMessage = "{0} No new trace in the past {1} min(s).";
- private const string IdleMessage = "{0} Stream terminated due to no new trace in the past {1} min(s).";
- private const string ErrorMessage = "\r\n{0} Error has occured and stream is terminated. {1}";
- private const string AppDomainShutdownMessage = "\r\n{0} The application was terminated.";
private const string FilterQueryKey = "filter";
// Antares 3 mins timeout, heartbeat every mins keep alive.
@@ -52,7 +48,7 @@ public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, o
// Close the client with a clear message when the app is shut down
_cancellationTokenRegistration = _shutdownDetector.Token.Register(() =>
{
- TerminateClient(String.Format(AppDomainShutdownMessage, DateTime.UtcNow.ToString("s")));
+ TerminateClient(String.Format(CultureInfo.CurrentCulture, Resources.LogStream_AppShutdown, Environment.NewLine, DateTime.UtcNow.ToString("s")));
});
string path = ParseRequest(context);
@@ -150,7 +146,7 @@ private void Reset()
private void WriteInitialMessage(HttpContext context)
{
- context.Response.Write(string.Format(InitialMessage, DateTime.UtcNow.ToString("s")));
+ context.Response.Write(String.Format(CultureInfo.CurrentCulture, Resources.LogStream_Welcome, DateTime.UtcNow.ToString("s")));
context.Response.Write(Environment.NewLine);
}
@@ -165,11 +161,11 @@ private void OnHeartbeat(object state)
{
if (ts >= IdleTimeout)
{
- TerminateClient(string.Format(IdleMessage, DateTime.UtcNow.ToString("s"), (int)ts.TotalMinutes));
+ TerminateClient(String.Format(CultureInfo.CurrentCulture, Resources.LogStream_Idle, DateTime.UtcNow.ToString("s"), (int)ts.TotalMinutes));
}
else
{
- NotifyClient(string.Format(HeartbeatMessage, DateTime.UtcNow.ToString("s"), (int)ts.TotalMinutes));
+ NotifyClient(String.Format(CultureInfo.CurrentCulture, Resources.LogStream_Heartbeat, DateTime.UtcNow.ToString("s"), (int)ts.TotalMinutes));
}
}
}
@@ -417,7 +413,7 @@ private void OnError(object sender, ErrorEventArgs e)
private void OnCriticalError(Exception ex)
{
- TerminateClient(string.Format(ErrorMessage, DateTime.UtcNow.ToString("s"), ex.Message));
+ TerminateClient(String.Format(CultureInfo.CurrentCulture, Resources.LogStream_Error, Environment.NewLine, DateTime.UtcNow.ToString("s"), ex.Message));
}
private void TerminateClient(string text)
@@ -120,10 +120,6 @@
<Reference Include="WebActivator">
<HintPath>..\packages\WebActivator.1.5.1\lib\net40\WebActivator.dll</HintPath>
</Reference>
- <Reference Include="XmlSettings, Version=0.1.2.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\XmlSettings.0.1.2.0\lib\net40\XmlSettings.dll</HintPath>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Kudu.Core\Infrastructure\FileSystemHelpers.cs">

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -207,4 +207,19 @@
<data name="VfsControllerBase_CannotDeleteDirectory" xml:space="preserve">
<value>Cannot delete directory. It is either not empty or access is not allowed.</value>
</data>
+ <data name="LogStream_AppShutdown" xml:space="preserve">
+ <value>{0}{1} The application was terminated.</value>
+ </data>
+ <data name="LogStream_Error" xml:space="preserve">
+ <value>{0}{1} Error has occured and stream is terminated. {2}</value>
+ </data>
+ <data name="LogStream_Heartbeat" xml:space="preserve">
+ <value>{0} No new trace in the past {1} min(s).</value>
+ </data>
+ <data name="LogStream_Idle" xml:space="preserve">
+ <value>{0} Stream terminated due to no new trace in the past {1} min(s).</value>
+ </data>
+ <data name="LogStream_Welcome" xml:space="preserve">
+ <value>{0} Welcome, you are now connected to log-streaming service.</value>
+ </data>
</root>
@@ -16,5 +16,4 @@
<package id="System.IO.Abstractions" version="1.4.0.35" targetFramework="net40" />
<package id="System.Spatial" version="5.0.2" targetFramework="net40" />
<package id="WebActivator" version="1.5.1" targetFramework="net40" />
- <package id="XmlSettings" version="0.1.2.0" targetFramework="net40" />
</packages>

0 comments on commit e4a82eb

Please sign in to comment.