Skip to content

Review and fix incorrect log function parameter order across codebase #21

@coderabbitai

Description

@coderabbitai

Issue Description

The log function is being called with parameters in the wrong order in some parts of the codebase. This causes errors to be logged at incorrect levels, potentially masking important errors as regular info logs.

Example Found

In src/controllers/llm.ts, the log function is called with the message first and level second:

log(`Error forwarding request: ${error.message}`, 'error')

The correct usage should be:

log('error', `Error forwarding request: ${error.message}`)

Required Action

  • Review the entire codebase for all usages of the log function
  • Ensure all calls follow the correct parameter order: log(level, message, error?)
  • Fix any instances where parameters are swapped
  • Consider adding TypeScript strict typing to prevent this issue in the future

Impact

When parameters are swapped, errors might be logged at INFO level instead of ERROR level, which can:

  • Defeat alerting systems based on log levels
  • Make troubleshooting difficult as critical errors are hidden among regular logs
  • Lead to false negatives in monitoring

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions