logdna / logdna/logdna-browser
Default Context not being attached to logs. per documentation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
## 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

### LogDNA Initialization Code
```typescript
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)
```json
"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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the TypeScript browser integration from the shown logdna.init configuration and compare emitted logs with the documented automatic context fields. Done means logs consistently include the default context, including location, user information, and environment, as described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100