Abhishek Pal
Abhishek Pal

Reputation: 13

SailsJS : Passing request identifier from policy to controller

I have defined a custom policy which is invoked for all controllers(works perfectly fine).

Im using winston for logging the requests into file and format goes as:

[date] - [log level]: [uuid] [log write]

uuid is to differentiate between simultaneous request log writes.

Now while logging the request details using winston, im not able to pass a uuid from my custom policy to controller.

I tried using req.options but i think im doing it wrong. Any suggestions?

Upvotes: 1

Views: 79

Answers (1)

Marek Urbanowicz
Marek Urbanowicz

Reputation: 13684

You can add anything to req . Just use e.g. req.uuid = uuid

Upvotes: 1

Related Questions