Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
keanemind opened this issue Jul 8, 2022 · 2 comments · Fixed by #44
Closed

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

keanemind opened this issue Jul 8, 2022 · 2 comments · Fixed by #44
Labels

Comments

@keanemind
Copy link

keanemind commented Jul 8, 2022

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
Copy link
Collaborator

@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',
  },
});

TerryMooreII added a commit that referenced this issue Jul 8, 2022
Summary:
Update readme to fix a misplaced option. Fix #43
TerryMooreII added a commit that referenced this issue Jul 8, 2022
Summary:
Update readme to fix a misplaced option. Fix #43
@logdnabot
Copy link
Member

🎉 This issue has been resolved in version 2.0.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants