[英]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:我使用 winston 将请求记录到文件中,格式如下:
[date] - [log level]: [uuid] [log write]
[日期] - [日志级别]:[uuid] [日志写入]
uuid is to differentiate between simultaneous request log writes. uuid 是为了区分同时请求日志写入。
Now while logging the request details using winston, im not able to pass a uuid from my custom policy to controller.现在,在使用 winston 记录请求详细信息时,我无法将 uuid 从我的自定义策略传递给控制器。
I tried using req.options but i think im doing it wrong.我尝试使用 req.options 但我认为我做错了。 Any suggestions?
有什么建议?
You can add anything to req
.您可以向
req
添加任何内容。 Just use eg req.uuid = uuid
只需使用例如
req.uuid = uuid
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.