форкнуто от Teknikode/Teknik
1
0
Форкнуть 0
Просмотр исходного кода

- Added logging config.

- Added log levels for logging utility.
master
Teknikode 5 лет назад
Родитель
Сommit
3f10fc6616
  1. 5
      Teknik/Configuration/Config.cs
  2. 37
      Teknik/Configuration/LoggingConfig.cs
  3. 1
      Teknik/Teknik.csproj
  4. 17
      Utilities/Logging/LogLevel.cs
  5. 9
      Utilities/Logging/Logger.cs
  6. 1
      Utilities/Logging/Logging.csproj

5
Teknik/Configuration/Config.cs

@ -41,6 +41,7 @@ namespace Teknik.Configuration @@ -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 @@ -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 @@ -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

@ -0,0 +1,37 @@ @@ -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
Teknik/Teknik.csproj

@ -241,6 +241,7 @@ @@ -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

@ -0,0 +1,17 @@ @@ -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
Utilities/Logging/Logger.cs

@ -12,5 +12,14 @@ namespace Teknik.Logging @@ -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
Utilities/Logging/Logging.csproj

@ -43,6 +43,7 @@ @@ -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" />

Загрузка…
Отмена
Сохранить