Added logging (Still WIP)

This commit is contained in:
tidusjar 2016-03-03 11:51:59 +00:00
commit 46dc9d95f1
10 changed files with 2651 additions and 2 deletions

View file

@ -0,0 +1,41 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: LogEntity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
namespace PlexRequests.Store.Models
{
public class LogEntity : Entity
{
public string Username { get; set; }
public DateTime Date { get; set; }
public string Level { get; set; }
public string Logger { get; set; }
public string Message { get; set; }
public string Callsite { get; set; }
public string Exception { get; set; }
}
}

View file

@ -41,6 +41,10 @@
<Reference Include="Mono.Data.Sqlite">
<HintPath>..\Assemblies\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.2.3\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -57,6 +61,7 @@
<Compile Include="ISqliteConfiguration.cs" />
<Compile Include="IRepository.cs" />
<Compile Include="Models\GlobalSettings.cs" />
<Compile Include="Models\LogEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repository\JsonRepository.cs" />
<Compile Include="SettingsModel.cs" />

View file

@ -39,4 +39,17 @@ CREATE TABLE IF NOT EXISTS GlobalSettings
Id INTEGER PRIMARY KEY AUTOINCREMENT,
SettingsName varchar(50) NOT NULL,
Content varchar(100) NOT NULL
);
CREATE TABLE IF NOT EXISTS Log
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Username varchar(50) NOT NULL,
Date varchar(100) NOT NULL,
Level varchar(100) NOT NULL,
Logger varchar(100) NOT NULL,
Message varchar(100) NOT NULL,
CallSite varchar(100) NOT NULL,
Exception varchar(100) NOT NULL
);

View file

@ -2,4 +2,5 @@
<packages>
<package id="Dapper" version="1.42" targetFramework="net452" />
<package id="Dapper.Contrib" version="1.42" targetFramework="net452" />
<package id="NLog" version="4.2.3" targetFramework="net452" />
</packages>