Skip to content

Commit

Permalink
fix(Tool): Restore filter logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Feb 26, 2024
1 parent d14b989 commit 1fb85ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Propulsion/StreamFilter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type StreamFilter([<Optional>] allowCats, [<Optional>] denyCats, [<Optional>] al
[<Optional>] allowEts, [<Optional>] denyEts,
[<Optional; DefaultParameterValue(false)>] ?incIndexes,
[<Optional; DefaultParameterValue(null)>] ?log) =
let log = defaultArg log Serilog.Log.Logger
let log = lazy defaultArg log Serilog.Log.Logger
let defA x = match x with null -> Array.empty | xs -> Seq.toArray xs

let allowCats, denyCats, incIndexes = defA allowCats, defA denyCats, defaultArg incIndexes false
Expand Down Expand Up @@ -35,8 +35,8 @@ type StreamFilter([<Optional>] allowCats, [<Optional>] denyCats, [<Optional>] al
let denyCats = if incIndexes then denyCats else Array.append denyCats [| "^\$" |]
let allowSns, denySns = match allowSns, denySns with [||], [||] -> [|".*"|], [||] | x -> x
let allowEts, denyEts = match allowEts, denyEts with [||], [||] -> [|".*"|], [||] | x -> x
log.Information("Categories ☑️ {@allowCats} 🚫{@denyCats} Streams ☑️ {@allowStreams} 🚫{denyStreams} Events ☑️ {allowEts} 🚫{@denyEts}",
asRe allowCats, asRe denyCats, asRe allowSns, asRe denySns, asRe allowEts, asRe denyEts)
log.Value.Information("Categories ☑️ {@allowCats} 🚫{@denyCats} Streams ☑️ {@allowStreams} 🚫{denyStreams} Events ☑️ {allowEts} 🚫{@denyEts}",
asRe allowCats, asRe denyCats, asRe allowSns, asRe denySns, asRe allowEts, asRe denyEts)
fun sn ->
validCat sn
&& validStream sn
Expand Down
3 changes: 1 addition & 2 deletions tools/Propulsion.Tool/Sync.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ and Arguments(c, p: ParseResults<Parameters>) =
| x -> p.Raise $"unexpected subcommand %A{x}"
member val StatsInterval = TimeSpan.minutes 1
member val StateInterval = TimeSpan.minutes 5
member val IdleDelay = TimeSpan.ms 10.
and [<NoEquality; NoComparison; RequireSubcommand>] SourceParameters =
| [<CliPrefix(CliPrefix.None); Last; Unique>] Cosmos of ParseResults<Args.Cosmos.Parameters>
| [<CliPrefix(CliPrefix.None); Last; Unique>] Dynamo of ParseResults<Args.Dynamo.Parameters>
Expand Down Expand Up @@ -243,7 +242,7 @@ let run appName (c: Args.Configuration, p: ParseResults<Parameters>) = async {
let json = Propulsion.Codec.NewtonsoftJson.RenderedSpan.ofStreamSpan stream events |> Propulsion.Codec.NewtonsoftJson.Serdes.Serialize
do! producer.ProduceAsync(FsCodec.StreamName.toString stream, json) |> Async.Ignore
return Propulsion.Sinks.StreamResult.AllProcessed, Outcome.render_ stream ham spam 0 }
Propulsion.Sinks.Factory.StartConcurrent(Log.Logger, maxReadAhead, maxConcurrentProcessors, handle a.Filters.EventFilter, stats, idleDelay = a.IdleDelay)
Propulsion.Sinks.Factory.StartConcurrent(Log.Logger, maxReadAhead, maxConcurrentProcessors, handle a.Filters.EventFilter, stats)
| SubCommand.Sync a ->
let eventsContext = a.ConnectEvents() |> Async.RunSynchronously
let stats = Propulsion.CosmosStore.CosmosStoreSinkStats(Log.Logger, statsInterval, stateInterval)
Expand Down

0 comments on commit 1fb85ba

Please sign in to comment.