mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 15:26:30 +00:00
fixed console Log
fix same files problem in python different libs correct command logging in command handler
This commit is contained in:
@@ -4,7 +4,9 @@ using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using Azaion.Common.DTO;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
namespace Azaion.Common.Services;
|
||||
|
||||
@@ -16,7 +18,7 @@ public interface IAzaionApi
|
||||
//Stream GetResource(string filename, string folder);
|
||||
}
|
||||
|
||||
public class AzaionApi(HttpClient client, ICache cache, ApiCredentials credentials) : IAzaionApi
|
||||
public class AzaionApi(ILogger logger, HttpClient client, ICache cache, ApiCredentials credentials) : IAzaionApi
|
||||
{
|
||||
private string _jwtToken = null!;
|
||||
const string APP_JSON = "application/json";
|
||||
@@ -116,7 +118,7 @@ public class AzaionApi(HttpClient client, ICache cache, ApiCredentials credentia
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
logger.Error(e, e.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class GalleryService(
|
||||
if (!existingAnnotations.ContainsKey(fName))
|
||||
{
|
||||
if (missedAnnotations.ContainsKey(fName))
|
||||
Console.WriteLine($"{fName} is already exists! Duplicate!");
|
||||
logger.LogInformation($"{fName} is already exists! Duplicate!");
|
||||
else
|
||||
missedAnnotations.TryAdd(fName, annotation);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class GalleryService(
|
||||
{
|
||||
ProgressFn = async num =>
|
||||
{
|
||||
Console.WriteLine($"Processed {num} item by Thread {Environment.CurrentManagedThreadId}");
|
||||
logger.LogInformation($"Processed {num} item by Thread {Environment.CurrentManagedThreadId}");
|
||||
ProcessedThumbnailsPercentage = imagesCount == 0 ? 0 : Math.Min(100, num * 100 / (double)imagesCount);
|
||||
ThumbnailsUpdate?.Invoke(ProcessedThumbnailsPercentage);
|
||||
await Task.CompletedTask;
|
||||
|
||||
@@ -54,15 +54,12 @@ public class GpsMatcherClient : IGpsMatcherClient
|
||||
WorkingDirectory = SecurityConstants.EXTERNAL_GPS_DENIED_FOLDER,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
process.OutputDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
|
||||
process.ErrorDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
|
||||
process.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
//throw;
|
||||
_logger.LogError(e, e.ToString());
|
||||
throw;
|
||||
}
|
||||
|
||||
_requestAddress = $"tcp://{gpsConfig.Value.ZeroMqHost}:{gpsConfig.Value.ZeroMqPort}";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Text;
|
||||
using Azaion.Common.DTO;
|
||||
using MessagePack;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NetMQ;
|
||||
using NetMQ.Sockets;
|
||||
@@ -18,6 +19,7 @@ public interface IInferenceClient : IDisposable
|
||||
|
||||
public class InferenceClient : IInferenceClient
|
||||
{
|
||||
private readonly ILogger<InferenceClient> _logger;
|
||||
public event EventHandler<RemoteCommand>? BytesReceived;
|
||||
public event EventHandler<RemoteCommand>? InferenceDataReceived;
|
||||
public event EventHandler<RemoteCommand>? AIAvailabilityReceived;
|
||||
@@ -28,8 +30,9 @@ public class InferenceClient : IInferenceClient
|
||||
private readonly InferenceClientConfig _inferenceClientConfig;
|
||||
private readonly LoaderClientConfig _loaderClientConfig;
|
||||
|
||||
public InferenceClient(IOptions<InferenceClientConfig> inferenceConfig, IOptions<LoaderClientConfig> loaderConfig)
|
||||
public InferenceClient(ILogger<InferenceClient> logger, IOptions<InferenceClientConfig> inferenceConfig, IOptions<LoaderClientConfig> loaderConfig)
|
||||
{
|
||||
_logger = logger;
|
||||
_inferenceClientConfig = inferenceConfig.Value;
|
||||
_loaderClientConfig = loaderConfig.Value;
|
||||
Start();
|
||||
@@ -46,15 +49,12 @@ public class InferenceClient : IInferenceClient
|
||||
Arguments = $"-p {_inferenceClientConfig.ZeroMqPort} -lp {_loaderClientConfig.ZeroMqPort} -a {_inferenceClientConfig.ApiUrl}",
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
process.OutputDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
|
||||
process.ErrorDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
|
||||
process.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
//throw;
|
||||
_logger.LogError(e, e.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
_dealer.Options.Identity = Encoding.UTF8.GetBytes(_clientId.ToString("N"));
|
||||
|
||||
@@ -26,20 +26,11 @@ public class LoaderClient(LoaderClientConfig config, ILogger logger, Cancellatio
|
||||
Arguments = $"--port {config.ZeroMqPort} --api {config.ApiUrl}",
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
process.OutputDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null) Console.WriteLine(e.Data);
|
||||
};
|
||||
process.ErrorDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null) Console.WriteLine(e.Data);
|
||||
};
|
||||
process.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error(e.Message);
|
||||
logger.Error(e, e.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class SatelliteDownloader(
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine($"Error while loading tile: {tileData}");
|
||||
logger.LogError($"Error while loading tile: {tileData}");
|
||||
}
|
||||
if (token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user