title: Event Logger Pattern in Scala
body: <p>All of our backend services is written in Scala. We mostly write pure functional Scala using Cats. </p>
  
  <p>I am trying to figure out if there is a design pattern in Cats or Scala in general that I can use to design a EventLogger. </p>
  
  <p>This eventLogger should collects "events" (simple key values) as the request flows through the logic. At the end of the request, I want to write the collected events to data store. We already have a "context" implicit parameter that gets passed to all the methods. I could add this EventLogger to my Context class and it would have access to the event logger from most parts of my code. Now I am trying to figure out how to design the eventLogger itself, without using a mutable collection. </p>
  
  <p>I have used to akka actors to collect states in the past to manage mutating states. I would prefer not to introduce Akka into our classpath just for this.</p>