Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Dec 11, 2024
1 parent 6574630 commit 77ff4cd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Kiota.Builder/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private async Task CleanOutputDirectoryAsync(CancellationToken cancellationToken
Directory.Delete(subDir, true);
await workspaceManagementService.BackupStateAsync(config.OutputPath, cancellationToken).ConfigureAwait(false);
foreach (var subFile in Directory.EnumerateFiles(config.OutputPath)
.Where(x => !x.EndsWith(FileLogLogger.LogFileName, StringComparison.OrdinalIgnoreCase)))
.Where(static x => !x.EndsWith(FileLogLogger.LogFileName, StringComparison.OrdinalIgnoreCase)))
File.Delete(subFile);
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/Kiota.Builder/Logging/FileLogLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
}
}

public class FileLogLogger<T> : FileLogLogger, ILogger<T>
public class FileLogLogger<T>(string logFileDirectoryAbsolutePath, LogLevel logLevel) : FileLogLogger(logFileDirectoryAbsolutePath, logLevel, typeof(T).FullName ?? string.Empty), ILogger<T>
{
public FileLogLogger(string logFileDirectoryAbsolutePath, LogLevel logLevel) : base(logFileDirectoryAbsolutePath, logLevel, typeof(T).FullName ?? string.Empty)
{
}
}
13 changes: 4 additions & 9 deletions src/Kiota.Builder/Logging/FileLogLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@

namespace Kiota.Builder.Logging;

public sealed class FileLogLoggerProvider : ILoggerProvider
public sealed class FileLogLoggerProvider(string logFileDirectoryAbsolutePath, LogLevel logLevel) : ILoggerProvider
{
private readonly LogLevel _logLevel;
private readonly string _logFileDirectoryAbsolutePath;
public FileLogLoggerProvider(string logFileDirectoryAbsolutePath, LogLevel logLevel)
{
_logLevel = logLevel;
_logFileDirectoryAbsolutePath = logFileDirectoryAbsolutePath;
}
private readonly List<FileLogLogger> _loggers = new();
private readonly LogLevel _logLevel = logLevel;
private readonly string _logFileDirectoryAbsolutePath = logFileDirectoryAbsolutePath;
private readonly List<FileLogLogger> _loggers = [];
public ILogger CreateLogger(string categoryName)
{
var instance = new FileLogLogger(_logFileDirectoryAbsolutePath, _logLevel, categoryName);
Expand Down
2 changes: 1 addition & 1 deletion src/kiota/Handlers/BaseKiotaCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected async Task CheckForNewVersionAsync(ILogger logger, CancellationToken c
DisplayWarning(result);
}
public abstract Task<int> InvokeAsync(InvocationContext context);
private readonly List<IDisposable> disposables = new();
private readonly List<IDisposable> disposables = [];
protected (ILoggerFactory, ILogger<T>) GetLoggerAndFactory<T>(InvocationContext context, string logFileRootPath = "")
{
LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption);
Expand Down

0 comments on commit 77ff4cd

Please sign in to comment.