logdna / logdna-browser

A frontend browser logging and exception capturing library for LogDNA
MIT License
19 stars 14 forks source link

"env" configuration option for init() does not seem to do anything #43

Closed keanemind closed 2 years ago

keanemind commented 2 years ago

Here is the config I am using:

logdna.init(LOGDNA_INGESTION_KEY, {
  app: "front-end",
  env: "staging", // this line doesn't seem to do anything
  console: false,
  globalErrorHandlers: false,
  sampleRate: 100,
});

For some reason in the logdna UI none of my logs for this app have an env field. It could be a misconfiguration on my end. As a workaround I've been adding an env field to the meta object of every log (using lineContext) which allows me to filter in the logdna UI by meta.env.

TerryMooreII commented 2 years ago

@keanemind It is incorrectly shown in the Readme.md. The env should be added to the .addContext() object for it or any other information to be added to ever log message. I will get the docs clean up and thanks for bring this to my attention.

Ex.

logdna.addContext({
  // Context is appended to the metadata of each message sent to LogDNA
  // Add any custom meta data such as:
  version: 'v1.0.2',
  env: 'dev'.
  user: {
    email: 'user@email.email',
    userId: '987654321',
  },
});
logdnabot commented 1 year ago

:tada: This issue has been resolved in version 2.0.11 :tada:

The release is available on:

Your semantic-release bot :package::rocket: