Skip to content

Commit

Permalink
fix(mavlink): add logger initialization where it's missing
Browse files Browse the repository at this point in the history
  • Loading branch information
asv-soft-u03 committed Sep 20, 2024
1 parent 96442ca commit 943f20f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Asv.Mavlink/Devices/Radio/Client/RadioClientDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public RadioClientDevice(
ILogger? logger = null)
: base(connection, identity, config, seq, scheduler, logger)
{
_logger ??= NullLogger.Instance;
_logger = logger ?? NullLogger.Instance;
_config = config ?? throw new ArgumentNullException(nameof(config));
Command = new CommandClient(connection, identity, seq, config.Command).DisposeItWith(Disposable);
var client = new AsvRadioClient(connection, identity,seq).DisposeItWith(Disposable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Asv.Mavlink.V2.Ardupilotmega;
using Asv.Mavlink.V2.Minimal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using ZLogger;

namespace Asv.Mavlink;
Expand All @@ -27,6 +28,7 @@ public ArduPlaneClient(IMavlinkV2Connection connection, MavlinkClientIdentity id
IScheduler? scheduler = null,
ILogger? logger = null) : base(connection, identity, config, seq, scheduler,logger)
{
_logger = logger ?? NullLogger.Instance;
}

protected override async Task InternalInit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Threading;
using Asv.Common;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using ZLogger;

namespace Asv.Mavlink;
Expand Down Expand Up @@ -77,7 +78,7 @@ public class FileSystemHierarchicalStore<TKey, TFile>:DisposableOnceWithCancel,I
{
private readonly string _rootFolder;
private readonly IHierarchicalStoreFormat<TKey,TFile> _format;
private readonly ILogger _logger;
private readonly ILogger? _logger;
private readonly object _sync = new();
private readonly RxValue<ushort> _count;
private readonly RxValue<ulong> _size;
Expand All @@ -86,8 +87,9 @@ public class FileSystemHierarchicalStore<TKey, TFile>:DisposableOnceWithCancel,I
private int _checkCacheInProgress;
private readonly TimeSpan _fileCacheTime;

public FileSystemHierarchicalStore(string rootFolder, IHierarchicalStoreFormat<TKey,TFile> format, TimeSpan? fileCacheTime)
public FileSystemHierarchicalStore(string rootFolder, IHierarchicalStoreFormat<TKey,TFile> format, TimeSpan? fileCacheTime, ILogger? logger = null)
{
_logger = logger ?? NullLogger.Instance;
if (format == null) throw new ArgumentNullException(nameof(format));
format.DisposeItWith(Disposable);
if (string.IsNullOrEmpty(rootFolder))
Expand Down

0 comments on commit 943f20f

Please sign in to comment.