Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
82,087 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Amazon.CloudWatchLogs; | ||
|
||
namespace Ivony.Logs.Aws | ||
{ | ||
public class CloudWatchLogger : CloudWatchLoggerBase | ||
{ | ||
|
||
|
||
|
||
public CloudWatchLogger( AmazonCloudWatchLogsClient client, string groupName, string streamName ) | ||
{ | ||
_client = client; | ||
GroupName = groupName; | ||
StreamName = streamName; | ||
} | ||
|
||
|
||
public string GroupName { get; private set; } | ||
|
||
public string StreamName { get; private set; } | ||
|
||
|
||
|
||
private AmazonCloudWatchLogsClient _client; | ||
|
||
protected override AmazonCloudWatchLogsClient Client { get { return _client; } } | ||
|
||
|
||
protected override string GetGroupName( LogEntry entry ) | ||
{ | ||
return GroupName; | ||
} | ||
|
||
protected override string GetStreamName( LogEntry entry ) | ||
{ | ||
return StreamName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Amazon.CloudWatchLogs; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Amazon.CloudWatchLogs.Model; | ||
|
||
namespace Ivony.Logs.Aws | ||
{ | ||
public abstract class CloudWatchLoggerBase : Logger | ||
{ | ||
|
||
public override void LogEntry( LogEntry entry ) | ||
{ | ||
|
||
Client.PutLogEvents( CreateRequest( entry ) ); | ||
|
||
} | ||
|
||
|
||
protected abstract AmazonCloudWatchLogsClient Client { get; } | ||
|
||
|
||
protected virtual PutLogEventsRequest CreateRequest( LogEntry entry ) | ||
{ | ||
return new PutLogEventsRequest | ||
{ | ||
LogEvents = new List<InputLogEvent> { CreateLogEvent( entry ) }, | ||
LogGroupName = GetGroupName( entry ), | ||
LogStreamName = GetStreamName( entry ), | ||
}; | ||
} | ||
|
||
protected abstract string GetStreamName( LogEntry entry ); | ||
|
||
protected abstract string GetGroupName( LogEntry entry ); | ||
|
||
protected virtual InputLogEvent CreateLogEvent( LogEntry entry ) | ||
{ | ||
return new InputLogEvent | ||
{ | ||
Message = entry.Message, | ||
Timestamp = entry.LogDate, | ||
}; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>9.0.30729</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{C34B4882-0280-4EFD-A12A-6E575A93D2B6}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Ivony.Logs.Aws</RootNamespace> | ||
<AssemblyName>Ivony.Logs.Aws</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<FileUpgradeFlags> | ||
</FileUpgradeFlags> | ||
<UpgradeBackupLocation> | ||
</UpgradeBackupLocation> | ||
<OldToolsVersion>3.5</OldToolsVersion> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<StartupObject /> | ||
</PropertyGroup> | ||
<Choose> | ||
<When Condition=" '$(TargetFrameworkVersion)' == 'v3.5' Or '$(TargetFrameworkVersion)' == 'v4.0' "> | ||
<ItemGroup> | ||
<Reference Include="AWSSDK.Core, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Private>True</Private> | ||
<HintPath>C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.Core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="AWSSDK.CloudWatch, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Private>True</Private> | ||
<HintPath>C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.CloudWatch.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
<Otherwise /> | ||
</Choose> | ||
<ItemGroup> | ||
<Reference Include="AWSSDK.CloudWatchLogs, Version=3.1.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\AWSSDK.CloudWatchLogs.3.1.2.4\lib\net45\AWSSDK.CloudWatchLogs.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="AWSSDK.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\AWSSDK.Core.3.1.5.0\lib\net45\AWSSDK.Core.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.configuration" /> | ||
<Reference Include="System.Core"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Xml.Linq"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Data.DataSetExtensions"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="CloudWatchLogger.cs" /> | ||
<Compile Include="CloudWatchLoggerBase.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Analyzer Include="..\packages\AWSSDK.CloudWatchLogs.3.1.2.4\analyzers\dotnet\cs\AWSSDK.CloudWatchLogs.CodeAnalysis.dll" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Ivony.Logs\Ivony.Logs.csproj"> | ||
<Project>{c6dba1a6-13c5-469b-bda9-c19838931205}</Project> | ||
<Name>Ivony.Logs</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle( "Ivony.Logs.Aws" )] | ||
[assembly: AssemblyDescription( "" )] | ||
[assembly: AssemblyConfiguration( "" )] | ||
[assembly: AssemblyProduct( "Ivony.Logs.Aws" )] | ||
[assembly: AssemblyCompany( "Amazon.com, Inc" )] | ||
[assembly: AssemblyCopyright( "Copyright 2009-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved." )] | ||
[assembly: AssemblyTrademark( "" )] | ||
[assembly: AssemblyCulture( "" )] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible( false )] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid( "3501d4c9-4bbe-4046-ba70-215d4b13dbda" )] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion( "1.0.0.0" )] | ||
[assembly: AssemblyFileVersion( "1.0.0.0" )] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="AWSSDK.CloudWatchLogs" version="3.1.2.4" targetFramework="net45" /> | ||
<package id="AWSSDK.Core" version="3.1.5.0" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="AWSSDK.CloudWatchLogs" version="3.1.2.4" targetFramework="net45" /> | ||
<package id="AWSSDK.Core" version="3.1.5.0" targetFramework="net45" /> | ||
</packages> |
Binary file added
BIN
+401 KB
packages/AWSSDK.CloudWatchLogs.3.1.2.4/AWSSDK.CloudWatchLogs.3.1.2.4.nupkg
Binary file not shown.
Binary file added
BIN
+36 KB
.../AWSSDK.CloudWatchLogs.3.1.2.4/analyzers/dotnet/cs/AWSSDK.CloudWatchLogs.CodeAnalysis.dll
Binary file not shown.
Oops, something went wrong.