Skip to content

Commit

Permalink
Merge pull request #1457 from qdraw/feature/202403_console_less_verbose
Browse files Browse the repository at this point in the history
Less verbose in console mode
  • Loading branch information
qdraw authored Mar 15, 2024
2 parents 1acce69 + be9c2e4 commit 683c3d8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static string GetFileName(string filePath,
/// <returns>Regex object</returns>
[GeneratedRegex(
"\\.[a-zA-Z0-9]{1,4}$",
RegexOptions.NonBacktracking,
RegexOptions.None,
matchTimeoutMilliseconds: 100)]
private static partial Regex FileNameWithoutExtensionRegex();

Expand All @@ -88,7 +88,7 @@ public static string GetFileNameWithoutExtension(string filePath)
/// <returns>Regex object</returns>
[GeneratedRegex(
"[^.][a-zA-Z0-9]{1,4}$",
RegexOptions.NonBacktracking,
RegexOptions.None,
matchTimeoutMilliseconds: 100)]
private static partial Regex FileExtensionWithoutDotRegex();

Expand Down
6 changes: 5 additions & 1 deletion starsky/starsky.foundation.platform/Services/WebLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ public WebLogger(ILoggerFactory? loggerFactory = null, IServiceScopeFactory? sco
{
_logger = loggerFactory?.CreateLogger("app");
var scopeProvider = scopeFactory?.CreateScope().ServiceProvider;
if ( scopeProvider != null ) _console = scopeProvider.GetService<IConsole>();
if ( scopeProvider != null )
{
_console = scopeProvider.GetService<IConsole>();
}
}

public void LogDebug(string? message, params object[] args)
Expand All @@ -40,6 +43,7 @@ public void LogDebug(string? message, params object[] args)
_console?.WriteLine(message);
return;
}

_logger.LogDebug(message, args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ internal async Task<List<FileIndexItem>> SingleFile(string subPath,

if ( statusItems.FirstOrDefault()!.Status != FileIndexItem.ExifStatus.Ok )
{
_logger.LogDebug($"[SingleFile/db] status " +
$"{statusItems.FirstOrDefault()!.Status} for {subPath} {Synchronize.DateTimeDebug()}");
_logger.LogDebug("[SingleFile/db] status " +
"{Status} for {subPath} {Time}",
statusItems.FirstOrDefault()!.Status, Synchronize.DateTimeDebug());
return statusItems;
}

Expand Down
5 changes: 5 additions & 0 deletions starsky/starskywebftpcli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using starsky.foundation.platform.Interfaces;
using starsky.foundation.platform.Models;
using starsky.foundation.storage.Interfaces;
using starsky.foundation.webtelemetry.Extensions;
using starsky.foundation.webtelemetry.Helpers;

namespace starskywebftpcli
{
Expand All @@ -25,6 +27,9 @@ public static async Task Main(string[] args)
var serviceProvider = services.BuildServiceProvider();
var appSettings = serviceProvider.GetRequiredService<AppSettings>();

services.AddOpenTelemetryMonitoring(appSettings);
services.AddTelemetryLogging(appSettings);

serviceProvider = services.BuildServiceProvider();

var storageSelector = serviceProvider.GetRequiredService<ISelectorStorage>();
Expand Down
1 change: 1 addition & 0 deletions starsky/starskywebftpcli/starskywebftpcli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\starsky.feature.webftppublish\starsky.feature.webftppublish.csproj"/>
<ProjectReference Include="..\starsky.foundation.platform\starsky.foundation.platform.csproj"/>
<ProjectReference Include="..\starsky.foundation.webtelemetry\starsky.foundation.webtelemetry.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(noSonar)' == 'true' ">
Expand Down
7 changes: 6 additions & 1 deletion starsky/starskywebhtmlcli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using starsky.foundation.platform.Interfaces;
using starsky.foundation.platform.Models;
using starsky.foundation.storage.Interfaces;
using starsky.foundation.webtelemetry.Extensions;
using starsky.foundation.webtelemetry.Helpers;

namespace starskywebhtmlcli
{
Expand All @@ -24,7 +26,10 @@ public static async Task Main(string[] args)
RegisterDependencies.Configure(services);
var serviceProvider = services.BuildServiceProvider();
var appSettings = serviceProvider.GetRequiredService<AppSettings>();


services.AddOpenTelemetryMonitoring(appSettings);
services.AddTelemetryLogging(appSettings);

new SetupDatabaseTypes(appSettings, services).BuilderDb();
serviceProvider = services.BuildServiceProvider();

Expand Down
1 change: 1 addition & 0 deletions starsky/starskywebhtmlcli/starskywebhtmlcli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\starsky.feature.webhtmlpublish\starsky.feature.webhtmlpublish.csproj"/>
<ProjectReference Include="..\starsky.foundation.platform\starsky.foundation.platform.csproj"/>
<ProjectReference Include="..\starsky.foundation.webtelemetry\starsky.foundation.webtelemetry.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(noSonar)' == 'true' ">
Expand Down

0 comments on commit 683c3d8

Please sign in to comment.