Browse Source

- Added logging config.

- Added log levels for logging utility.
tags/2.0.6
Teknikode 3 years ago
parent
commit
3f10fc6616

+ 5
- 0
Teknik/Configuration/Config.cs 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();
}


+ 37
- 0
Teknik/Configuration/LoggingConfig.cs 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;
}
}
}

+ 1
- 0
Teknik/Teknik.csproj 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" />

+ 17
- 0
Utilities/Logging/LogLevel.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
}
}

+ 9
- 0
Utilities/Logging/Logger.cs 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)
{
}
}
}

+ 1
- 0
Utilities/Logging/Logging.csproj 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" />

Loading…
Cancel
Save