- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在我的 Sails.js 应用程序中设置 Winston Loggly。我关注了Sails.js - Using A Custom Logger文档并设置我的 /config/log.js
文件,如下所示:
// Send logs to Loggly using Winston
var winston = require('winston');
require('winston-loggly');
var customLogger = new winston.Logger();
customLogger.add(winston.transports.Loggly, {
inputToken: MY INPUT TOKEN,
auth: {
username: MY USERNAME,
password: MY PASSWORD
},
subdomain: MY SUBDOMAIN,
level: 'info',
tags: ['web-service', process.env.NODE_ENV],
json: true
});
module.exports.log = {
level: 'info',
custom: customLogger,
// Disable captain's log so it doesn't prefix or stringify our meta data.
inspect: false
};
无论我做什么,我都会在控制台中收到以下错误:
/Users/Nag/Code/web-service/node_modules/winston-loggly/node_modules/loggly/lib/loggly/client.js:190
return isSolid.test(tag) && tag.length <= 64;
^
TypeError: Cannot read property 'length' of undefined
at /Users/Nag/Code/web-service/node_modules/winston-loggly/node_modules/loggly/lib/loggly/client.js:190:36
at Array.filter (native)
at Loggly.tagFilter (/Users/Nag/Code/web-service/node_modules/winston-loggly/node_modules/loggly/lib/loggly/client.js:186:15)
at new exports.Loggly (/Users/Nag/Code/web-service/node_modules/winston-loggly/node_modules/loggly/lib/loggly/client.js:62:12)
at Object.exports.createClient (/Users/Nag/Code/web-service/node_modules/winston-loggly/node_modules/loggly/lib/loggly/client.js:30:10)
at new exports.Loggly (/Users/Nag/Code/web-service/node_modules/winston-loggly/lib/winston-loggly.js:50:24)
at Logger.add (/Users/Nag/Code/web-service/node_modules/winston/lib/winston/logger.js:475:41)
at Object.<anonymous> (/Users/Nag/Code/web-service/config/log.js:18:14)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at /usr/local/lib/node_modules/sails/node_modules/include-all/index.js:129:29
at Array.forEach (native)
at requireAll (/usr/local/lib/node_modules/sails/node_modules/include-all/index.js:44:9)
at buildDictionary (/usr/local/lib/node_modules/sails/node_modules/sails-build-dictionary/index.js:68:14)
at Function.module.exports.aggregate (/usr/local/lib/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)
at Array.loadOtherConfigFiles (/usr/local/lib/node_modules/sails/lib/hooks/moduleloader/index.js:239:27)
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:591:38
at _arrayEach (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:85:13)
我似乎无法解决这个问题。我该如何修复它?
最佳答案
该错误似乎表明,由于某种原因,您的 process.env.NODE_ENV 为 null、空或未定义。你能检查一下吗?
关于Node.js - Winston-loggly 模块抛出 "Cannot read property ' length' of undefined”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39900899/
我只是有一个更琐碎的问题。 为什么undefined == undefined 返回true,而undefined >= undefined 为false? undefined 等于 undefine
用PHP 7.2编写套接字服务器。根据Firefox 60中的“网络”选项卡,服务器的一些HTTP响应的第一行随机变为undefined undefined undefined。因此,我尝试记录套接字
在 JavaScript 中这是真的: undefined == undefined 但这是错误的: undefined <= undefined 起初我以为<=运算符包含第一个,但我猜它试图将其转换
在回答这个问题 (Difference between [Object, Object] and Array(2)) 时,我在 JavaScript 数组中遇到了一些我以前不知道的东西(具有讽刺意味的
来自https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/of , Note: thi
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
当我添加 到我的 PrimeFaces Mobile 页面,然后我在服务器日志中收到以下警告 WARNING: JSF1064: Unable to find or serve resource, u
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我是一名优秀的程序员,十分优秀!