Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Nullinside.Api.TwitchBot/Controllers/BotController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Security.Claims;

using log4net;

using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

Expand Down Expand Up @@ -32,16 +34,14 @@ public class BotController : ControllerBase {
/// <summary>
/// The logger.
/// </summary>
private readonly ILogger<BotController> _logger;
private readonly ILog _log = LogManager.GetLogger(typeof(BotController));

/// <summary>
/// Initializes a new instance of the <see cref="LoginController" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="dbContext">The nullinside database.</param>
/// <param name="configuration">The application's configuration.</param>
public BotController(ILogger<BotController> logger, NullinsideContext dbContext, IConfiguration configuration) {
_logger = logger;
public BotController(NullinsideContext dbContext, IConfiguration configuration) {
_dbContext = dbContext;
_configuration = configuration;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Nullinside.Api.TwitchBot/Controllers/LoginController.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using log4net;

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

Expand Down Expand Up @@ -26,16 +28,14 @@ public class LoginController : ControllerBase {
/// <summary>
/// The logger.
/// </summary>
private readonly ILogger<LoginController> _logger;
private readonly ILog _log = LogManager.GetLogger(typeof(LoginController));

/// <summary>
/// Initializes a new instance of the <see cref="LoginController" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="dbContext">The nullinside database.</param>
/// <param name="configuration">The application's configuration.</param>
public LoginController(ILogger<LoginController> logger, NullinsideContext dbContext, IConfiguration configuration) {
_logger = logger;
public LoginController(NullinsideContext dbContext, IConfiguration configuration) {
_dbContext = dbContext;
_configuration = configuration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ItemGroup>
<PackageReference Include="log4net.Ext.Json" Version="2.0.10.1"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
16 changes: 8 additions & 8 deletions src/Nullinside.Api.TwitchBot/Services/MainService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Concurrent;

using log4net;

using Microsoft.EntityFrameworkCore;

using Nullinside.Api.Common.Twitch;
Expand Down Expand Up @@ -42,7 +44,7 @@ public class MainService : BackgroundService {
/// <summary>
/// The logger.
/// </summary>
private readonly ILogger<MainService> _log;
private readonly ILog _log = LogManager.GetLogger(typeof(MainService));

/// <summary>
/// A collection of all bans received.
Expand Down Expand Up @@ -80,10 +82,8 @@ public class MainService : BackgroundService {
/// <summary>
/// Initializes a new instance of the <see cref="MainService" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="serviceScopeFactory">The service scope factory.</param>
public MainService(ILogger<MainService> logger, IServiceScopeFactory serviceScopeFactory) {
_log = logger;
public MainService(IServiceScopeFactory serviceScopeFactory) {
_serviceScopeFactory = serviceScopeFactory;
_scope = _serviceScopeFactory.CreateScope();
_db = _scope.ServiceProvider.GetRequiredService<NullinsideContext>();
Expand Down Expand Up @@ -116,7 +116,7 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) {
await Main(stoppingToken);
}
catch (Exception ex) {
_log.LogError(ex, "Main Failed");
_log.Error("Main Failed", ex);
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
}
}
Expand Down Expand Up @@ -179,7 +179,7 @@ private async Task Main(CancellationToken stoppingToken) {
await DoScan(user, botUser, stoppingToken);
}
catch (Exception ex) {
_log.LogError(ex, $"Scan failed for {user.TwitchUsername}");
_log.Error($"Scan failed for {user.TwitchUsername}", ex);
}
});
}
Expand All @@ -190,7 +190,7 @@ private async Task Main(CancellationToken stoppingToken) {
}
}
catch (Exception ex) {
_log.LogError(ex, "Main Inner failed");
_log.Error("Main Inner failed", ex);
}
}

Expand Down Expand Up @@ -297,7 +297,7 @@ private async Task DoScan(User user, User botUser, CancellationToken stoppingTok
}
}
catch (Exception e) {
_log.LogError(e, $"{user.TwitchUsername}: Failed to evaluate rule");
_log.Error($"{user.TwitchUsername}: Failed to evaluate rule", e);
}
}

Expand Down
Loading