thefrontside / simulacrum

A simulation platform for use during testing, during development and for high-fidelity application previews
91 stars 14 forks source link

add basic logging middleware #135

Closed dagda1 closed 3 years ago

dagda1 commented 3 years ago

Motivation

We need more visibility as to what is going on in simulators like auth0 which are annoying to debug.

Approach

There is a basic middleware component in @simulacrum/server that simulators can use to log HTTP requests.

It can take 1 or more logging function. I've add one logging function to auth0 that writes to the affection inspector:

app: createHttpApp()
      .use(createLoggingMiddleware(function * (message) {
        yield label({ name: 'auth0-logging-middleware', log: message });
      }))

It should be easy to add other loggers like console.log for quicker debugging.

taras commented 3 years ago

@dagda1 it's a bit difficult to tell from this what the log output looks like. Can add a screenshot of output that you see?

dagda1 commented 3 years ago

@dagda1 it's a bit difficult to tell from this what the log output looks like. Can add a screenshot of output that you see?

Very basic but considerably better what we have now which is nothing log and this is the output from console.log