mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
log service
This commit is contained in:
parent
a5256a6491
commit
b69304992f
5 changed files with 70 additions and 0 deletions
|
@ -125,6 +125,7 @@
|
|||
<Compile Include="Renderers\ExtendedListViewRenderer.cs" />
|
||||
<Compile Include="Renderers\HybridWebViewRenderer.cs" />
|
||||
<Compile Include="Services\AndroidPushNotificationService.cs" />
|
||||
<Compile Include="Services\AndroidLogService.cs" />
|
||||
<Compile Include="SplashActivity.cs" />
|
||||
<Compile Include="MainApplication.cs" />
|
||||
<Compile Include="MainActivity.cs" />
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace Bit.Droid
|
|||
|
||||
private void RegisterLocalServices()
|
||||
{
|
||||
ServiceContainer.Register<ILogService>("logService", new AndroidLogService());
|
||||
ServiceContainer.Register("settingsShim", new App.Migration.SettingsShim());
|
||||
if(App.Migration.MigrationHelpers.NeedsMigration())
|
||||
{
|
||||
|
|
30
src/Android/Services/AndroidLogService.cs
Normal file
30
src/Android/Services/AndroidLogService.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using Bit.Core.Abstractions;
|
||||
using System;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
public class AndroidLogService : ILogService
|
||||
{
|
||||
private static readonly string _tag = "BITWARDEN";
|
||||
|
||||
public void Debug(string message)
|
||||
{
|
||||
Android.Util.Log.WriteLine(Android.Util.LogPriority.Debug, _tag, message);
|
||||
}
|
||||
|
||||
public void Info(string message)
|
||||
{
|
||||
Android.Util.Log.WriteLine(Android.Util.LogPriority.Info, _tag, message);
|
||||
}
|
||||
|
||||
public void Warning(string message)
|
||||
{
|
||||
Android.Util.Log.WriteLine(Android.Util.LogPriority.Warn, _tag, message);
|
||||
}
|
||||
|
||||
public void Error(string message)
|
||||
{
|
||||
Android.Util.Log.WriteLine(Android.Util.LogPriority.Error, _tag, message);
|
||||
}
|
||||
}
|
||||
}
|
10
src/Core/Abstractions/ILogService.cs
Normal file
10
src/Core/Abstractions/ILogService.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
namespace Bit.Core.Abstractions
|
||||
{
|
||||
public interface ILogService
|
||||
{
|
||||
void Debug(string message);
|
||||
void Error(string message);
|
||||
void Info(string message);
|
||||
void Warning(string message);
|
||||
}
|
||||
}
|
28
src/Core/Services/ConsoleLogService.cs
Normal file
28
src/Core/Services/ConsoleLogService.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using Bit.Core.Abstractions;
|
||||
using System;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
public class ConsoleLogService : ILogService
|
||||
{
|
||||
public void Debug(string message)
|
||||
{
|
||||
Console.WriteLine("DEBUG: {0}", message);
|
||||
}
|
||||
|
||||
public void Info(string message)
|
||||
{
|
||||
Console.WriteLine("INFO: {0}", message);
|
||||
}
|
||||
|
||||
public void Warning(string message)
|
||||
{
|
||||
Console.WriteLine("WARNING: {0}", message);
|
||||
}
|
||||
|
||||
public void Error(string message)
|
||||
{
|
||||
Console.WriteLine("ERROR: {0}", message);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue