Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log4net dependency #890

Merged
merged 4 commits into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
Expand All @@ -66,7 +62,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Apis\Logging\Log4NetLogger.cs" />
<Compile Include="Apis\Util\Store\FileDataStore.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\CommonAssemblyInfo.cs">
Expand Down
2 changes: 1 addition & 1 deletion Src/Support/GoogleApis.DotNet4/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.3" targetFramework="net45" />

</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void SetUp(bool useLogger)
if (useLogger)
{
#if !NETSTANDARD
ApplicationContext.RegisterLogger(new Google.Apis.Logging.Log4NetLogger());
ApplicationContext.RegisterLogger(new Google.Apis.Tests.Logging.Log4NetLogger());
#endif
}
}
Expand Down
1 change: 1 addition & 0 deletions Src/Support/GoogleApis.Tests/GoogleApis.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
<Compile Include="Apis\Utils\RepeatableTest.cs" />
<Compile Include="ApplicationContextTests.cs" />
<Compile Include="Json\JsonExplicitNullTest.cs" />
<Compile Include="Logging\Log4NetLogger.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\CommonAssemblyInfo.cs">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
/*
Copyright 2011 Google Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.Reflection;
using log4net;
using Google.Apis.Util;
namespace Google.Apis.Logging
{
/// <summary>A logger implementation which makes use of the log4net library.</summary>
public sealed class Log4NetLogger : ILogger
{
private readonly ILog log;
static Log4NetLogger()
{
log4net.Config.XmlConfigurator.Configure();
}
private Log4NetLogger(string name)
{
log = LogManager.GetLogger(name);
}
/// <summary>Creates a new default log4net logger.</summary>
public Log4NetLogger() : this("google-api-dotnet-client") { }
/// <summary>Creates a new log4net logger and associates it with the specified type.</summary>
public Log4NetLogger(Type t) : this(t.FullName) { }
public bool IsDebugEnabled
{
get { return log.IsDebugEnabled; }
}
public ILogger ForType(Type type)
{
return new Log4NetLogger(type);
}
public ILogger ForType<T>()
{
return new Log4NetLogger(typeof(T));
}
public void Info(string message, params object[] formatArgs)
{
log.Info(string.Format(message, formatArgs));
}
public void Warning(string message, params object[] formatArgs)
{
log.Warn(string.Format(message, formatArgs));
}
public void Debug(string message, params object[] formatArgs)
{
log.Debug(string.Format(message, formatArgs));
}
public void Error(Exception exception, string message, params object[] formatArgs)
{
log.Error(string.Format(message, formatArgs), exception);
}
public void Error(string message, params object[] formatArgs)
{
log.Error(string.Format(message, formatArgs));
}
}
}
/*
Copyright 2011 Google Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#if !NETSTANDARD

using System;
using Google.Apis.Logging;
using log4net;

namespace Google.Apis.Tests.Logging
{
/// <summary>A logger implementation which makes use of the log4net library.</summary>
public sealed class Log4NetLogger : ILogger
{
private readonly ILog log;

static Log4NetLogger()
{
log4net.Config.XmlConfigurator.Configure();
}

private Log4NetLogger(string name)
{
log = LogManager.GetLogger(name);
}

/// <summary>Creates a new default log4net logger.</summary>
public Log4NetLogger() : this("google-api-dotnet-client") { }

/// <summary>Creates a new log4net logger and associates it with the specified type.</summary>
public Log4NetLogger(Type t) : this(t.FullName) { }

public bool IsDebugEnabled
{
get { return log.IsDebugEnabled; }
}

public ILogger ForType(Type type)
{
return new Log4NetLogger(type);
}

public ILogger ForType<T>()
{
return new Log4NetLogger(typeof(T));
}

public void Info(string message, params object[] formatArgs)
{
log.Info(string.Format(message, formatArgs));
}

public void Warning(string message, params object[] formatArgs)
{
log.Warn(string.Format(message, formatArgs));
}

public void Debug(string message, params object[] formatArgs)
{
log.Debug(string.Format(message, formatArgs));
}

public void Error(Exception exception, string message, params object[] formatArgs)
{
log.Error(string.Format(message, formatArgs), exception);
}

public void Error(string message, params object[] formatArgs)
{
log.Error(string.Format(message, formatArgs));
}
}
}
#endif
6 changes: 0 additions & 6 deletions Src/Support/GoogleApis/Google.Apis.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
<tags>Google</tags>
<dependencies>
<group targetFramework="net45">
<!--
log4net is required by the Net45 version of
Google.Apis.PlatformServices.
-->
<dependency id="log4net" version="2.0.3" />

<dependency id="Google.Apis.Core" version="$version$" />
<dependency id="Zlib.Portable.Signed" version="1.11.0" />
</group>
Expand Down