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:
parent
1920dda2af
commit
3f10fc6616
@ -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();
|
||||
}
|
||||
|
||||
|
37
Teknik/Configuration/LoggingConfig.cs
Normal file
37
Teknik/Configuration/LoggingConfig.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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" />
|
||||
|
17
Utilities/Logging/LogLevel.cs
Normal file
17
Utilities/Logging/LogLevel.cs
Normal 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
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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" />
|
||||
|
Loading…
Reference in New Issue
Block a user