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

Add structured logging #696

Open
temich opened this issue Jul 10, 2024 · 0 comments
Open

Add structured logging #696

temich opened this issue Jul 10, 2024 · 0 comments

Comments

@temich
Copy link
Contributor

temich commented Jul 10, 2024

Abstract Implementation

Log entry model

time: string # 2024-07-10T15:16:50.530Z
context:
  component: math.calculator
  operation: pow
severity: 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR'
message: string
attributes?: Record<string, unknown>
{"time": "2024-07-10T15:16:50.530Z", ... }

Aspect

async effect (input, context) {
  context.logs.info('')

 /* TODO:
  context.metrics.hist()
  context.metrics.inc()
  
  context.span('calculations', (telemetry) => {
    // calculations

    telemetry.logs.info('calculated')
    telemetry.metrics.inc('calculations')

    telemetry.span('reporting', (telemetry) => {
      context.remote.reports.foo.add({ })
    })
  })
  */
}

Logging function signature

log(message: string, ...values: string, attributes?: Record<string, string | number | boolean>): void

log('Message %n from %s has been sent', id, username, { balance })

From util.format.

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

No branches or pull requests

1 participant