fgm / filog

A fine logger package for Meteor.JS applications (client + server)
GNU General Public License v3.0
18 stars 6 forks source link

Split context by source, identify source #63

Open fgm opened 6 years ago

fgm commented 6 years ago

Introduce a SourceProcessor modifying the context handling logic to format context introduced by client processors within a context.client property, (resp. server, cordova), and introduce a top-level source property identifying the origin of the logged message, so that client-sent messages can end up structured like:

{
  "_id" : "Q2656X7y3BbdEJnHp",
  "level" : 6,
  "message" : "some message",
  "context" : {
    "message_details" : {
      "arg1" : "answer",
      "arg2" : 42,
    },
    "source": "client",
    "client" : {
      "browser" : { /*..snip.. */ },
      "routing" :  { /*..snip.. */ },
      "customprocessor" : "other data"
    },
    "server" : {
      "hostname" : "fgm-linux-figaro",
      "user" : {
        "_id" : "wEbSie2FbizumzHyf",
        "createdAt" : ISODate("2018-06-29T16:03:18.583Z"),
        "services" : {
          "customauth" : { { /*..snip */ } ,
        }
      }
    },
    "timestamp" : {
      "log" : 1531235569008,
      "store" : 1531235569008
    },
  }
}
fgm commented 5 years ago

Follow implementation on #67