1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

- Added logging config.

- Added log levels for logging utility.
This commit is contained in:
Uncled1023 2017-01-10 23:39:15 -08:00
parent 1920dda2af
commit 3f10fc6616
6 changed files with 70 additions and 0 deletions

View File

@ -41,6 +41,7 @@ namespace Teknik.Configuration
private ShortenerConfig _ShortenerConfig;
private TransparencyConfig _TransparencyConfig;
private DatabaseConfig _DatabaseConfig;
private LoggingConfig _LoggingConfig;
private PiwikConfig _PiwikConfig;
public bool DevEnvironment { get { return _DevEnvironment; } set { _DevEnvironment = value; } }
@ -98,6 +99,9 @@ namespace Teknik.Configuration
// Database Configuration
public DatabaseConfig DatabaseConfig { get { return _DatabaseConfig; } set { _DatabaseConfig = value; } }
// Logging Configuration
public LoggingConfig LoggingConfig { get { return _LoggingConfig; } set { _LoggingConfig = value; } }
// Piwik Configuration
public PiwikConfig PiwikConfig { get { return _PiwikConfig; } set { _PiwikConfig = value; } }
@ -139,6 +143,7 @@ namespace Teknik.Configuration
ShortenerConfig = new ShortenerConfig();
TransparencyConfig = new TransparencyConfig();
DatabaseConfig = new DatabaseConfig();
LoggingConfig = new LoggingConfig();
PiwikConfig = new PiwikConfig();
}

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Configuration
{
public class LoggingConfig
{
public bool Enabled { get; set; }
public string OutputDirectory { get; set; }
public string LogLevel { get; set; }
public bool RotateLogs { get; set; }
public long MaxSize { get; set; }
public int MaxCount { get; set; }
public LoggingConfig()
{
SetDefaults();
}
public void SetDefaults()
{
Enabled = true;
OutputDirectory = string.Empty;
LogLevel = "Info";
RotateLogs = false;
MaxSize = -1;
MaxCount = -1;
}
}
}

View File

@ -241,6 +241,7 @@
<Compile Include="Areas\User\Models\TrustedDevice.cs" />
<Compile Include="Areas\User\ViewModels\TwoFactorViewModel.cs" />
<Compile Include="Attributes\TeknikAuthorizeAttribute.cs" />
<Compile Include="Configuration\LoggingConfig.cs" />
<Compile Include="Filters\CORSActionFilter.cs" />
<Compile Include="Helpers\BundleExtensions.cs" />
<Compile Include="Models\TransferTypes.cs" />

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Logging
{
public enum LogLevel
{
Trace = 0,
Debug = 1,
Info = 2,
Warning = 3,
Error = 4
}
}

View File

@ -12,5 +12,14 @@ namespace Teknik.Logging
{
}
public void WriteEntry(Exception ex)
{
// write an entry to the logs
}
public void WriteEntry(string message, LogLevel level)
{
}
}
}

View File

@ -43,6 +43,7 @@
<ItemGroup>
<Compile Include="Logger.cs" />
<Compile Include="Logging.cs" />
<Compile Include="LogLevel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />