- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在基于 webpack 的应用程序中设置 Bunyan。
我有以下 webpack 配置:
// these shims are needed for bunyan
alias: {
'dtrace-provider': path.resolve('empty-shim.js'),
"fs": path.resolve('empty-shim.js'),
'safe-json-stringify': path.resolve('empty-shim.js'),
"mv": path.resolve('empty-shim.js'),
'source-map-support': path.resolve('empty-shim.js')
}
其中empty-shim是一个空文件
以及我的记录器中定义的以下流:
{
level: "trace",
path: "/logs/trace.log"
// Logging from external libraries used by your app or very detailed application logging.
},
{
level: "debug",
path: "/logs/debug.log"
// Anything else, i.e. too verbose to be included in "info" level.
},
{
level: "info",
path: "/logs/info.log"
// Detail on regular operation.
},
{
level: "warn",
path: "/logs/warn.log"
// A note on something that should probably be looked at by an operator eventually.
},
{
level: "error",
stream: process.stderr // we pipe error also to stdout
// Fatal for a particular request, but the service/app continues
// servicing other requests. An operator should look at this soon(ish).
},
{
level: "error",
path: "/logs/error.log"
// Fatal for a particular request, but the service/app continues
// servicing other requests. An operator should look at this soon(ish).
},
{
level: "fatal",
path: "/logs/fatal.log"
// The service/app is going to stop or become unusable now.
// An operator should definitely look into this soon.
}
当我尝试访问我的记录器时,我收到此错误:
Uncaught TypeError: fs.createWriteStream is not a function
at Logger.addStream (http://localhost:8080/bundle.js:81080:28)
at http://localhost:8080/bundle.js:80958:19
at Array.forEach (native)
at new Logger (http://localhost:8080/bundle.js:80957:26)
at Function.createLogger (http://localhost:8080/bundle.js:82060:13)
at BunyanLogger.getLogger (http://localhost:8080/bundle.js:80479:18)
我认为这是因为 fs 已被填充到一个空文件。
我怎样才能让它发挥作用?
最佳答案
我通过使用 bunyan-sfdx-no-dtrace
别名作为 bunyan
的替代方案来解决这个烦恼。它是一个删除 dtrace 内容的 fork 。
这只是我的 webpack.config.js
的相关部分
module.exports = {
resolve: {
alias: {
bunyan: "bunyan-sfdx-no-dtrace"
}
}
};
<小时/>
免责声明 AFAICT 本身和 Bunyan-sfdx-no-dtrace 均未主动/正确维护,因此买家请小心。我必须处理这个问题,因为 Bunyan 是我需要的模块的子依赖项。
关于javascript - Bunyan with webpack - 尝试访问已被填充的 fs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41108089/
我已经创建了一个 bunyan 的记录器实例 export const createLogger = ( appname: string, ) => bunyan.createLogger({
我试图在我的nodejs应用程序中使用bunyan,但是我坚持这种奇怪的行为。像这样定义记录器: var info = bunyan.createLogger({ name: 'Test',
child.log.info('info'); child.log.debug('debug'); 我使用以下命令: node app.js | bunyan -o short -l debug 但是
我知道这是一个非常抽象的问题,但我只是不知道从哪里/如何开始。 我正在使用bunyan作为我的应用程序中的日志库。这是用于记录某些内容的示例语法: const log = bunyan.create
我正在使用 Bunyan 和 Restify 创建一个 access.log,它将存储有关请求的信息,例如端点、状态代码等...但是,我想将错误与此文件分开并存储它们在单独的日志文件中。 我尝试通过向
有什么方法可以监视 bunyan 日志以确保打印出我期望的内容? MyFile.js const bunyan = require('bunyan'); const log = bunyan.crea
我正在尝试在基于 webpack 的应用程序中设置 Bunyan。 我有以下 webpack 配置: // these shims are needed for bunyan al
这个问题已经有答案了: Logging in nodejs using bunyan logger (3 个回答) 已关闭 8 年前。 我的 NodeJS 应用程序有问题,我想正确记录使用它时发生的所
我已将 Bunyan 日志记录添加到我的应用程序的各个子系统中。但是当我查看日志文件时,我发现日志不是按时间戳排序的。我认为这是预期的,因为 Nodejs 的异步特性。 我想知道是否有任何方法可以更改
有一个 Bunyan 日志,这是一个示例条目 [2016-05-31T15:38:47.889Z] FATAL: jklajsd-utilities/23399 on aaa.bbb.ccc.com:
我正在试验 Node bunyan 模块。作为其中的一部分,我想知道一些关于 Bunyan 的事实.. bunyan 是否提供了一种方法来更改 bunyan 日志上打印的内容的顺序。例如,默认情况下时
我正在使用 bunyan.js 作为我的日志记录解决方案,我想为其日志记录功能添加功能。 例如,我想在每次调用 log.fatal() 时向第三方 API 发送一些内容 这可能吗?我查看了文档,但没有
我用 node.js 和 express 构建了一个应用程序。我已经开始使用 bunyan,但我很难理解热记录请求。 假设我的路由器调用这样的函数: function(request, someOth
使用 Bunyan 时,我所有的日志级别都使用相同的青色,如下所示: 这是我们使用的 Bunyan 配置: const bunyan = require('bunyan'); module.expor
我一直在寻找用于登录我的 nodejs 应用程序的 bunyan。我试过了,一切似乎都运行良好。我跳过了a section在 log.child 上,但现在我正试图了解如何使用它。我认为它的目的是允许
这些是默认字段 { "name": "myapp", "hostname": "banana.local", "pid": 40161, "level": 30, "msg": "
我使用的是bunyan,这是我在日志中写入的示例。 有没有办法改变打印字段的顺序?从此: {"name":"appName","hostname":"ip","pid":5817,"level":30
默认情况下,Sentry 集成了 console.log 以使其成为面包屑的一部分: 链接:Import name: Sentry.Integrations.Console 我们如何让它为 bunya
我正在使用 Bunyan 和 bunyas-lumberjack 将我的日志发送到日志存储并在 Elasticsearch 中为它们编制索引。我面临的问题是当我过滤日志时:我正在使用 Logstash
我通读了 Joyent 的事后调试文章和 they recommended我们使用 bunyan。 他们谈到日志信息的质量非常重要,并且可以在出现错误时帮助解决错误。然后有外部博客网站展示了如何在他们
我是一名优秀的程序员,十分优秀!