Skip to content

Should F# API have a set of log functions for semantic logging? #8040

@object

Description

@object

Akka.NET F# API has two sets of logging functions:

  • logDebug, logError etc.
  • logDebugf, logErrorf etc.

The second set calls kprintf internall so it's possible to use syntax like this:

logDebugf mmailbox "This is an integer %d, and this is a string %s" 123 "abc"
None of the above will work with semantic logging. So in order to use semanting logging a method on ILogginAdapter must be called:

logger.Debug("This is an integer {IntValue}, and this is a string {StringValue}", 123, "abc")
Would it be suitable to extend F# API with idiomatic calls by adding a set of functions logDebugs, logErrors etc., so the following syntax could be used:

`logDebugs "This is an integer {IntValue}, and this is a string {StringValue}" [ 123; "abc" ]

The methods for semantic logging need to be defined like this:

let logDebugs (mailbox: Actor) (msg: string) (args: obj seq) =
    let logger = mailbox.Log.Force()
    logger.Log(LogLevel.DebugLevel, msg, Seq.toArray args)

What do you think? I am maintaining an alternative F# API (Akkling) and would like to extend it similarly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions