Skip to content

Commit 5a56a51

Browse files
committed
Upgrade to loggly-csharp 4.5.1.11
1 parent 85f34e4 commit 5a56a51

19 files changed

+667
-92
lines changed

Eleven41.Logging.Loggly.sln

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.30501.0
4+
VisualStudioVersion = 12.0.31101.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eleven41.Logging.Loggly", "Eleven41.Logging.Loggly\Eleven41.Logging.Loggly.csproj", "{CFFCEB96-C4A0-4A1D-B3A1-C5F8B3C42B33}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{E0C1D039-2293-45F8-AD20-D48C5E8B3B6E}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicExample1", "Samples\BasicExample1\BasicExample1.csproj", "{7D8D5FB0-63C6-46EA-873B-9686387292C9}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThreadedExample1", "Samples\ThreadedExample1\ThreadedExample1.csproj", "{EB79E6FC-3382-42E9-9C3C-52CE6D649DDE}"
13+
EndProject
814
Global
915
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1016
Debug|Any CPU = Debug|Any CPU
@@ -15,8 +21,20 @@ Global
1521
{CFFCEB96-C4A0-4A1D-B3A1-C5F8B3C42B33}.Debug|Any CPU.Build.0 = Debug|Any CPU
1622
{CFFCEB96-C4A0-4A1D-B3A1-C5F8B3C42B33}.Release|Any CPU.ActiveCfg = Release|Any CPU
1723
{CFFCEB96-C4A0-4A1D-B3A1-C5F8B3C42B33}.Release|Any CPU.Build.0 = Release|Any CPU
24+
{7D8D5FB0-63C6-46EA-873B-9686387292C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{7D8D5FB0-63C6-46EA-873B-9686387292C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{7D8D5FB0-63C6-46EA-873B-9686387292C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{7D8D5FB0-63C6-46EA-873B-9686387292C9}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{EB79E6FC-3382-42E9-9C3C-52CE6D649DDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{EB79E6FC-3382-42E9-9C3C-52CE6D649DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{EB79E6FC-3382-42E9-9C3C-52CE6D649DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{EB79E6FC-3382-42E9-9C3C-52CE6D649DDE}.Release|Any CPU.Build.0 = Release|Any CPU
1832
EndGlobalSection
1933
GlobalSection(SolutionProperties) = preSolution
2034
HideSolutionNode = FALSE
2135
EndGlobalSection
36+
GlobalSection(NestedProjects) = preSolution
37+
{7D8D5FB0-63C6-46EA-873B-9686387292C9} = {E0C1D039-2293-45F8-AD20-D48C5E8B3B6E}
38+
{EB79E6FC-3382-42E9-9C3C-52CE6D649DDE} = {E0C1D039-2293-45F8-AD20-D48C5E8B3B6E}
39+
EndGlobalSection
2240
EndGlobal

Eleven41.Logging.Loggly/Eleven41.Logging.Loggly.csproj

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>Eleven41.Logging</RootNamespace>
1111
<AssemblyName>Eleven41.Logging.Loggly</AssemblyName>
12-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
1515
</PropertyGroup>
@@ -21,6 +21,7 @@
2121
<DefineConstants>DEBUG;TRACE</DefineConstants>
2222
<ErrorReport>prompt</ErrorReport>
2323
<WarningLevel>4</WarningLevel>
24+
<Prefer32Bit>false</Prefer32Bit>
2425
</PropertyGroup>
2526
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2627
<DebugType>pdbonly</DebugType>
@@ -29,17 +30,24 @@
2930
<DefineConstants>TRACE</DefineConstants>
3031
<ErrorReport>prompt</ErrorReport>
3132
<WarningLevel>4</WarningLevel>
33+
<Prefer32Bit>false</Prefer32Bit>
3234
</PropertyGroup>
3335
<ItemGroup>
3436
<Reference Include="Eleven41.Logging, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
3537
<SpecificVersion>False</SpecificVersion>
3638
<HintPath>..\..\LogglyTest\packages\Eleven41.Logging.1.3.1\Lib\net20\Eleven41.Logging.dll</HintPath>
3739
</Reference>
38-
<Reference Include="Loggly">
39-
<HintPath>..\packages\loggly-csharp.2.5.1\lib\net40\Loggly.dll</HintPath>
40+
<Reference Include="Loggly, Version=4.5.1.0, Culture=neutral, processorArchitecture=MSIL">
41+
<HintPath>..\packages\loggly-csharp.4.5.1.11\lib\net45\Loggly.dll</HintPath>
42+
<Private>True</Private>
4043
</Reference>
41-
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
42-
<HintPath>..\packages\Newtonsoft.Json.5.0.1\lib\net40\Newtonsoft.Json.dll</HintPath>
44+
<Reference Include="Loggly.Config, Version=4.5.1.0, Culture=neutral, processorArchitecture=MSIL">
45+
<HintPath>..\packages\loggly-csharp-config.4.5.1.11\lib\net45\Loggly.Config.dll</HintPath>
46+
<Private>True</Private>
47+
</Reference>
48+
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
49+
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
50+
<Private>True</Private>
4351
</Reference>
4452
<Reference Include="System" />
4553
<Reference Include="System.configuration" />
@@ -51,11 +59,15 @@
5159
<Reference Include="System.Xml" />
5260
</ItemGroup>
5361
<ItemGroup>
62+
<Compile Include="LogglyBase.cs" />
5463
<Compile Include="LogglyLog.cs" />
5564
<Compile Include="Properties\AssemblyInfo.cs" />
65+
<Compile Include="ThreadedLogglyLog.cs" />
5666
</ItemGroup>
5767
<ItemGroup>
58-
<None Include="Eleven41.Logging.Loggly.nuspec" />
68+
<None Include="Eleven41.Logging.Loggly.nuspec">
69+
<SubType>Designer</SubType>
70+
</None>
5971
<None Include="packages.config" />
6072
</ItemGroup>
6173
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Eleven41.Logging.Loggly/Eleven41.Logging.Loggly.nuspec

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22
<package >
33
<metadata>
44
<id>Eleven41.Logging.Loggly</id>
5-
<version>1.2.1</version>
5+
<version>2.0.0</version>
66
<authors>Eleven41 Software</authors>
77
<owners>Eleven41 Software</owners>
88
<licenseUrl>https://github.com/eleven41/Eleven41.Logging.Loggly/blob/master/LICENSE.md</licenseUrl>
99
<projectUrl>https://github.com/eleven41/Eleven41.Logging.Loggly</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1111
<description>Eleven41.Logging.Loggly is an implementation of Eleven41.Logging.ILog to send log messages to Loggly.</description>
12-
<releaseNotes>Allows thread property to be overwritten by caller.</releaseNotes>
13-
<copyright>Copyright (C) 2014, Eleven41 Software Inc.</copyright>
12+
<releaseNotes>
13+
Updated the version of loggly-csharp.
14+
Note a change to configuration.
15+
</releaseNotes>
16+
<copyright>Copyright (C) 2016, Eleven41 Software Inc.</copyright>
1417
<tags>logging loggly</tags>
1518
<dependencies>
16-
<dependency id="Eleven41.Logging" version="1.2.0" />
17-
<dependency id="loggly-csharp" version="2.5.1" />
18-
<dependency id="Newtonsoft.Json" version="5.0.1" />
19+
<dependency id="Eleven41.Logging" version="1.3.1" />
20+
<dependency id="loggly-csharp" version="4.5.1.11" />
21+
<dependency id="loggly-csharp-config" version="4.5.1.11" />
22+
<dependency id="Newtonsoft.Json" version="6.0.8" />
1923
</dependencies>
2024
</metadata>
2125
</package>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Eleven41.Logging
8+
{
9+
public abstract class LogglyBase
10+
{
11+
protected Loggly.ILogglyClient _client;
12+
13+
public LogglyBase()
14+
{
15+
_client = new Loggly.LogglyClient();
16+
17+
this.Data = new Dictionary<string, object>();
18+
this.DateTimeProvider = new Eleven41.Logging.DateTimeProviders.UtcDateTimeProvider();
19+
}
20+
21+
public LogglyBase(Dictionary<string, object> data)
22+
{
23+
_client = new Loggly.LogglyClient();
24+
25+
if (data != null)
26+
this.Data = new Dictionary<string, object>(data);
27+
else
28+
this.Data = new Dictionary<string, object>();
29+
this.DateTimeProvider = new Eleven41.Logging.DateTimeProviders.UtcDateTimeProvider();
30+
}
31+
32+
private Dictionary<string, object> _data;
33+
34+
public Dictionary<string, object> Data
35+
{
36+
get { return _data; }
37+
set
38+
{
39+
// Ensure we this.Data is never null
40+
if (value == null)
41+
throw new ArgumentNullException("Data", "Data must not be null");
42+
43+
_data = value;
44+
}
45+
}
46+
47+
public bool IsSync { get; set; }
48+
49+
IDateTimeProvider _dateTimeProvider;
50+
51+
public IDateTimeProvider DateTimeProvider
52+
{
53+
get
54+
{
55+
return _dateTimeProvider;
56+
}
57+
set
58+
{
59+
if (value == null)
60+
throw new ArgumentNullException();
61+
_dateTimeProvider = value;
62+
}
63+
}
64+
}
65+
}

Eleven41.Logging.Loggly/LogglyLog.cs

Lines changed: 17 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,84 +6,21 @@
66

77
namespace Eleven41.Logging
88
{
9-
public class LogglyLog : ILog
9+
public class LogglyLog : LogglyBase, ILog
1010
{
11-
private Loggly.Logger _logger;
12-
1311
public LogglyLog()
1412
{
15-
string logglyKey = System.Configuration.ConfigurationManager.AppSettings["Loggly.Key"];
16-
if (String.IsNullOrEmpty(logglyKey))
17-
throw new Exception("Loggly.Key empty or missing from appSettings.");
18-
19-
_logger = new Loggly.Logger(logglyKey);
20-
this.Data = new Dictionary<string, object>();
2113
}
2214

2315
public LogglyLog(Dictionary<string, object> data)
16+
: base(data)
2417
{
25-
string logglyKey = System.Configuration.ConfigurationManager.AppSettings["Loggly.Key"];
26-
if (String.IsNullOrEmpty(logglyKey))
27-
throw new Exception("Loggly.Key empty or missing from appSettings.");
28-
29-
_logger = new Loggly.Logger(logglyKey);
30-
if (data != null)
31-
this.Data = new Dictionary<string, object>(data);
32-
else
33-
this.Data = new Dictionary<string, object>();
3418
}
3519

36-
public LogglyLog(string logglyKey)
37-
{
38-
_logger = new Loggly.Logger(logglyKey);
39-
this.Data = new Dictionary<string, object>();
40-
}
41-
42-
public LogglyLog(string logglyKey, Dictionary<string, object> data)
43-
{
44-
_logger = new Loggly.Logger(logglyKey);
45-
if (data != null)
46-
this.Data = new Dictionary<string, object>(data);
47-
else
48-
this.Data = new Dictionary<string, object>();
49-
}
50-
51-
public LogglyLog(LogglyLog other)
52-
{
53-
_logger = other._logger;
54-
this.Data = new Dictionary<string, object>();
55-
}
56-
57-
public LogglyLog(LogglyLog other, Dictionary<string, object> data)
58-
{
59-
_logger = other._logger;
60-
if (data != null)
61-
this.Data = new Dictionary<string, object>(data);
62-
else
63-
this.Data = new Dictionary<string, object>();
64-
}
65-
66-
private Dictionary<string, object> _data;
67-
68-
public Dictionary<string, object> Data
69-
{
70-
get { return _data; }
71-
set
72-
{
73-
// Ensure we this.Data is never null
74-
if (value == null)
75-
throw new ArgumentNullException("Data", "Data must not be null");
76-
77-
_data = value;
78-
}
79-
}
80-
81-
public bool IsSync { get; set; }
82-
8320
public void Log(LogLevels level, string sFormat, params object[] args)
8421
{
8522
// Call the data version
86-
Log(DateTime.UtcNow, level, null, sFormat, args);
23+
Log(this.DateTimeProvider.GetCurrentDateTime(), level, null, sFormat, args);
8724
}
8825

8926
public void Log(DateTime date, LogLevels level, string sFormat, params object[] args)
@@ -93,12 +30,12 @@ public void Log(DateTime date, LogLevels level, string sFormat, params object[]
9330

9431
public void Log(LogLevels level, Dictionary<string, object> messageData, string sFormat, params object[] args)
9532
{
96-
Log(DateTime.UtcNow, level, null, sFormat, args);
33+
Log(this.DateTimeProvider.GetCurrentDateTime(), level, null, sFormat, args);
9734
}
9835

9936
public void Log(DateTime date, LogLevels level, Dictionary<string, object> messageData, string sFormat, params object[] args)
10037
{
101-
if (_logger == null)
38+
if (_client == null)
10239
return;
10340

10441
// Start with the standard properties
@@ -122,11 +59,20 @@ public void Log(DateTime date, LogLevels level, Dictionary<string, object> messa
12259
data["date"] = date;
12360

12461
// Serialize and dispatch
125-
string json = Newtonsoft.Json.JsonConvert.SerializeObject(data);
62+
var logglyEvent = new Loggly.LogglyEvent();
63+
foreach (var key in data.Keys)
64+
{
65+
logglyEvent.Data.Add(key, data[key]);
66+
}
67+
12668
if (this.IsSync)
127-
_logger.LogSync(json, true);
69+
{
70+
var response = _client.Log(logglyEvent).Result;
71+
}
12872
else
129-
_logger.Log(json, true);
73+
{
74+
_client.Log(logglyEvent).ConfigureAwait(false);
75+
}
13076
}
13177
}
13278
}

Eleven41.Logging.Loggly/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("Eleven41 Software Inc.")]
1212
[assembly: AssemblyProduct("Eleven41.Logging.Loggly")]
13-
[assembly: AssemblyCopyright("Copyright © 2014, Eleven41 Software Inc.")]
13+
[assembly: AssemblyCopyright("Copyright © 2016, Eleven41 Software Inc.")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.1.0")]
36-
[assembly: AssemblyFileVersion("1.2.1.0")]
35+
[assembly: AssemblyVersion("2.0.0.0")]
36+
[assembly: AssemblyFileVersion("2.0.0.0")]

0 commit comments

Comments
 (0)