奥特尔-杰森-洛格
JSON 诊断打开远程测量的日志
折旧:此图书馆将不再维持. 冒着自己的风险使用!
安装
npm install --save @dreamit/otel-json-logger
项目内提供类型脚本申报.
兼容性
奥特尔-杰森-洛格 与 @ opletetmeterm/ api (打开的距离) ^ 1. 6.0 版本.
特征
- 为 OpenTeleometry 提供 JSON 记录器 对话框 接口
- 用对象和阵列以及日志参数来字符串/检查信件,以避免破坏记录工具
- 为日志条目创建 ISODate 时间戳
使用量
创建一个 杰森·迪亚格-洛克 通过提供匹配对象 日志器Name 财务报告和审定财务报表 服务Name。可以独立地使用记录器对 JSON 进行控制控制 全球 对话框。 。 。 .
import { JsonDiagLogger } from '@dreamit/otel-json-logger'
import { diag, DiagLogLevel } from "@opentelemetry/api";
// Standalone
const logger = new JsonDiagLogger({
loggerName: 'test-logger', // The loggerName printed in field "logger"
serviceName: 'test-service', // The serviceName printed in field "serviceName"
minLogLevel: 'INFO', // Optional: The minimum log level to use. Default: Does not check for min LogLevel.
logFirstIncomingRequest: true, // Optional: If true, the first incoming request will be logged. Other messages on debug level will be log if minLogLevel is set to debug or higher. Default: false. Note: If you use diag.setLogger ensure that at least "DEBUG" is set, otherwise the message will be ignored.
logLevelForAsyncAttributeError: 'INFO' // Optional: The log level to use for the message "Accessing resource attributes before async attributes settled". These errors might not be relevant enough to log them on error level.
logLevelForRegisterGlobalMessages: 'INFO' // Optional: The log level to use for messages "... Registered a global ...". These are helpful to check if OTEL is running properly but are logged on debug level by default. Increase this log level to see these messages.
logLevelForServiceRequestErrorMessages: 'INFO', // Optional: The log level to use for error message "Service request". These contain request information that might not be logged on error level.
logLevelForTimeoutErrorMessages: 'INFO', // Optional: The log level to use for Timeout related messages. These might be of short nature and be downgraded or ignored.
logLevelForVerbose: 'OFF' // Optional: Set LogLevel for verbose entries or ignore them
truncateLimit: 200 // Optional: The length of the message before the message gets truncated. Default: undefined/0 (off).
truncatedText: '_TRC_' // Optional: The text to display if a message is truncated.
})
logger.debug('test', 1, {name: 'myname'})
// Add as global DiagLogger
diag.setLogger(logger, DiagLogLevel.ERROR)
JsonDiagLogger 函数
一般职能
- 创建日志 Entry: 创建并返回类型日志条目 日志条目 提供了有关资料.
- 负数: 由所有人调用的中心功能 对话框 接口功能。 电话 创建日志 Entry,字符串结果和呼叫 控制台.log ()。 。 。 .
- 格式: 格式化信件。 如果信件中包含一个对象或阵列,将其包裹在JSON.stringify中以避免这些被解释为JSON对象.
- 设置选项: 设置 锁定选项 用于伐木。 可以在构建器调用后调用设置新/ 其他选项 .
- 包含超时:检查信件是否包含"4 DEADLINE EXED"或"14 UNAVAILALA"等超时信息.
- 正在请求日志:检查这些参数是否属于来函请求信件的一部分,即第一个参数包含"来函请求"的文本
- 是等效或更高的明洛格级:检查日志级别是否等于或高于最小日志级别.
- 包含 Async 属性错误: 检查信件中是否包含像"在Async属性确定前访问资源属性"这样的async属性错误.
DiagLogger 接口功能
- 调试: 记录调试消息
- 错误: 记录错误消息
- 资讯: 记录信息消息
- 动词: 记录动词消息
- 警告( e): 记录警告消息
日志级值
- 吉布提
- 错误
- 信息通报
- 关闭 : 不要登录这些条目 !
- 韦尔布斯
- 战争
更改日志
ưμ㼯a
日志级别 已经从 enum 类型改为字符串类型.
联系人
如果你有问题,请访问我们 问题页 如果还没有适合你议题的问题,就打开一个新问题.
许可证
奥特尔 -杰森 -洛格下方 麻省理工学院。 。 。 .