Skip to content

Make equivalent for product types #960

Open
@alexcardell

Description

@alexcardell

An Attributes.Make equivalent could be helpful for product types we want to extract multiple attributes out of easily

case class Record(i: Int, s: String, c: MyType)
val record: Record = ???

implicit val makeMyType: Attribute.Make[MyType] = ???

implicit val attributesRecord: Attributes.Make[Record] = 
    new Attributes.Make { record =>
         Attributes(List(... /* list of attributes for i, s, c fields */))
    }

Trace[F].span("new-span", record).surround { ... }

Looks quite convenient, could also be quite useful structured logging, I'd like to wire this up to a log4cats wrapper.

Is there a more convenient way of deriving this that could be provided? Or can the existing Attribute.Make be wrangled to not need this

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions