summary refs log tree commit diff
path: root/MatrixSystemdBridge/Worker.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-09-08 19:49:20 +0200
committerRory& <root@rory.gay>2025-09-08 19:49:20 +0200
commit71d20fc41b37c21361b63566c2aaf3324617affc (patch)
treeded4b283a2841d2746b345afd0599fe44dd1319e /MatrixSystemdBridge/Worker.cs
parentUse https for submodules (diff)
downloadMatrixLogFwd-71d20fc41b37c21361b63566c2aaf3324617affc.tar.xz
Add LibSystemd
Diffstat (limited to 'MatrixSystemdBridge/Worker.cs')
-rw-r--r--MatrixSystemdBridge/Worker.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/MatrixSystemdBridge/Worker.cs b/MatrixSystemdBridge/Worker.cs
new file mode 100644

index 0000000..ee23c79 --- /dev/null +++ b/MatrixSystemdBridge/Worker.cs
@@ -0,0 +1,24 @@ +namespace MatrixSystemdBridge; + +public class Worker : BackgroundService +{ + private readonly ILogger<Worker> _logger; + + public Worker(ILogger<Worker> logger) + { + _logger = logger; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + while (!stoppingToken.IsCancellationRequested) + { + if (_logger.IsEnabled(LogLevel.Information)) + { + _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); + } + + await Task.Delay(1000, stoppingToken); + } + } +} \ No newline at end of file