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

Implement Structured Logging with Enhanced Contextual Information #15

Open
monilpat opened this issue Dec 21, 2024 · 0 comments
Open

Implement Structured Logging with Enhanced Contextual Information #15

monilpat opened this issue Dec 21, 2024 · 0 comments
Labels
enhancement New feature or request logging

Comments

@monilpat
Copy link
Owner

Feature Request

Is your feature request related to a problem? Please describe.

The current logging system lacks structured output and meaningful contextual information, which hinders the ability to effectively trace and debug issues across the application.

Describe the solution you'd like

Implement a structured logging framework, such as Bunyan or Winston, that supports JSON output and allows for the injection of contextual information. This should include:

  • Standard fields such as timestamp, severity level, and correlation ID.
  • Capability to add custom fields for enhanced context.
  • Proper log levels (DEBUG, INFO, WARN, ERROR) for better log management.

Code Example

const bunyan = require('bunyan');
const logger = bunyan.createLogger({
    name: 'eliza',
    streams: [
        {
            level: 'info',
            stream: process.stdout
        },
        {
            level: 'error',
            path: '/var/tmp/eliza-error.log'
        }
    ],
    serializers: {
        err: bunyan.stdSerializers.err
    }
});
logger.info({ userId: '12345', action: 'login' }, 'User logged in successfully');

Describe alternatives you've considered

Continuing with unstructured logs, but this approach makes it difficult to perform efficient log analysis and debugging.

Additional context

Enhancing the logging structure will significantly improve the observability of the system, making it easier to trace issues and understand system behavior.

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request logging
Projects
None yet
Development

No branches or pull requests

1 participant