Skip to content

Default Context not being attached to logs. per documentation #74

@BryantDavis1986

Description

@BryantDavis1986

Issue Report: LogDNA Browser Logging

Description

There is an issue with the logging mechanism in the LogDNA browser integration. The logs occasionally fail to capture the default context, including location, user information, environment, etc.

Example Log

image

LogDNA Initialization Code

const hostname = 'Tradeweb-User-Interface';
logdna.init(CONFIG.logDnaApiKey, {
  app: `Tradeweb-User-Interface`,
  env: CONFIG.env,
  hostname: hostname,
  enableStacktrace: true,
  enableIpAddress: true,
  console: CONFIG.logDnaEnabledLocally
});
if (CONFIG.logDnaEnabledLocally) {
  console.log = (message, ...optionalParams) => logdna.log({ message: chalk.green(message, JSON.stringify(optionalParams)) });
  console.error = (message, ...optionalParams) => logdna.error({ message: chalk.red(message, JSON.stringify(optionalParams)) });
  console.debug = (message, ...optionalParams) => logdna.debug({ message: chalk.blue(message, JSON.stringify(optionalParams)) });
  console.warn = (message, ...optionalParams) => logdna.warn({ message: chalk.yellow(message, JSON.stringify(optionalParams))});
  console.info = (message, ...optionalParams) => logdna.info({ message: chalk.cyan(message, JSON.stringify(optionalParams))});
}

Automatically Added Context (from documentation)

"sessionId": "d1b69ea3-41c4-4b9b-85e2-32fb94cb219c",
"browser": {
  "name": "chrome",
  "version": "87.0.4280",
  "os": "Mac OS",
  "type": "browser"
},
"location": {
  "ancestorOrigins": {},
  "href": "https://your-web-app/home?q=1234567890",
  "origin": "https://your-web-app",
  "protocol": "https:",
  "host": "your-web-app",
  "hostname": "your-web-app",
  "port": "",
  "pathname": "/home",
  "search": "?q=1234567890",
  "hash": ""
}

Expected Behavior

The logs should consistently capture the default context, including location, user information, environment, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions