如何登录 SailsJS [英] How to Log in SailsJS

查看:36
本文介绍了如何登录 SailsJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

登录 SailsJS 的实际语法是什么?

What is the actual syntax to log in SailsJS?

文档没有任何内容,但在站点的路线图中找到了以下行

Docs don't have anything, but found the following line in the site's roadmap

将 Sails.log(winston 包装器)作为一个单独的模块拉出来,这样它就可以被水线使用"

"Pull out Sails.log (winston wrapper) as a separate module so it can be used by waterline"

我认为它是这样的:

Sails.log(...)
Sails.error(...)
Sails.warn(...)

推荐答案

在您的控制器、模型、服务以及 sails 全局可用的任何其他地方,您可以使用以下选项之一登录:

In your controllers, models, services, and anywhere else that the sails global is available, you can log with one of:

sails.log();
sails.log.warn();
sails.log.info();
sails.log.debug();
sails.log.error();
sails.log.verbose();
sails.log.silly();

日志级别(即日志输出到控制台的级别)在/config/log.js中设置.

The logging level (that is, the level at which logs will be output to the console) is set in /config/log.js.

这篇关于如何登录 SailsJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆