diff --git a/src/Umbraco.Core/Logging/LogHelper.cs b/src/Umbraco.Core/Logging/LogHelper.cs
index 9291ffec1d..0513699f4e 100644
--- a/src/Umbraco.Core/Logging/LogHelper.cs
+++ b/src/Umbraco.Core/Logging/LogHelper.cs
@@ -9,6 +9,7 @@ namespace Umbraco.Core.Logging
///
/// Used for logging
///
+ [Obsolete("Use UmbracoContext.Current.Application.Services.LoggingService instead")]
public static class LogHelper
{
///
diff --git a/src/Umbraco.Core/Services/ILoggingService.cs b/src/Umbraco.Core/Services/ILoggingService.cs
new file mode 100644
index 0000000000..1094428c5e
--- /dev/null
+++ b/src/Umbraco.Core/Services/ILoggingService.cs
@@ -0,0 +1,40 @@
+using System;
+
+namespace Umbraco.Core.Services
+{
+ ///
+ /// Interface for logging service.
+ ///
+ public interface ILoggingService
+ {
+ void Error(string message, Exception exception);
+ void Error(Type callingType, string message, Exception exception);
+ void Warn(Type callingType, string message, params Func
public class ServiceContext
{
+ private Lazy _loggingService;
private Lazy _tagService;
private Lazy _contentService;
private Lazy _userService;
@@ -52,6 +54,7 @@ namespace Umbraco.Core.Services
///
///
///
+ ///
public ServiceContext(
IContentService contentService,
IMediaService mediaService,
@@ -69,7 +72,7 @@ namespace Umbraco.Core.Services
ISectionService sectionService,
IApplicationTreeService treeService,
ITagService tagService,
- INotificationService notificationService)
+ INotificationService notificationService, ILoggingService loggingService)
{
_tagService = new Lazy(() => tagService);
_contentService = new Lazy(() => contentService);
@@ -88,7 +91,7 @@ namespace Umbraco.Core.Services
_memberService = new Lazy(() => memberService);
_userService = new Lazy(() => userService);
_notificationService = new Lazy(() => notificationService);
-
+ _loggingService = new Lazy(() => loggingService);
}
///
@@ -174,6 +177,10 @@ namespace Umbraco.Core.Services
_tagService = new Lazy(() => new TagService(provider, repositoryFactory.Value));
if (_memberGroupService == null)
_memberGroupService = new Lazy(() => new MemberGroupService(provider, repositoryFactory.Value));
+
+
+ if (_loggingService== null)
+ _loggingService = new Lazy(() => new LoggingService());
}
@@ -328,6 +335,13 @@ namespace Umbraco.Core.Services
{
get { return _memberGroupService.Value; }
}
-
+
+ ///
+ /// Gets the LoggingService
+ ///
+ public ILoggingService LoggingService
+ {
+ get { return _loggingService.Value; }
+ }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 5d72a83243..089969ba3f 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -1,4 +1,4 @@
-
+
Debug
@@ -106,7 +106,7 @@
True
..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll
-
+
False
@@ -315,6 +315,8 @@
+
+
diff --git a/src/Umbraco.Tests/MockTests.cs b/src/Umbraco.Tests/MockTests.cs
index f8810fe67f..5e895ae9d1 100644
--- a/src/Umbraco.Tests/MockTests.cs
+++ b/src/Umbraco.Tests/MockTests.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Web;
using NUnit.Framework;
using Umbraco.Core;
+using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.UnitOfWork;
using Umbraco.Core.Services;
@@ -56,7 +57,7 @@ namespace Umbraco.Tests
new Mock().Object,
new Mock().Object,
new Mock().Object,
- new Mock().Object);
+ new Mock().Object, new Mock().Object);
Assert.Pass();
}
@@ -101,7 +102,7 @@ namespace Umbraco.Tests
new Mock().Object,
new Mock().Object,
new Mock().Object,
- new Mock().Object),
+ new Mock().Object, new Mock().Object),
CacheHelper.CreateDisabledCacheHelper());
Assert.Pass();