Skip to content

Is it possible to output traces locally #2030

Answered by dreamorosi
kaykhan asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @kaykhan, thanks for opening this discussion.

Generally speaking, you should be able to instruct the underlying X-Ray SDK to emit logs by using the tracer.provider.setLogger() constructor as described in our docs here. The page I linked shows how to use our Powertools Logger, but you can also use the regular console.log by passing an object with this shape:

var logger = {
  error: (message, meta) => { /* logging code */ },
  warn: (message, meta) => { /* logging code */ },
  info: (message, meta) => { /* logging code */ },
  debug: (message, meta) => { /* logging code */ }
}

Once you set a logger, the X-Ray SDK will emit a number of logs, including one emitted here that logs a segment…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kaykhan
Comment options

Answer selected by kaykhan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants