You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logger 에서 Error 객체를 empty object 로 출력하고 있음. logger 를 구현하기 위해 사용한 winston 에서 Error 객체를 핸들링하는데 문제가 있는 것으로 확인. 관련 이슈
비교 케이스
Note
출력 예시는 가독성을 위해 출력 내용을 다듬은 내용입니다. 데이터는 동일하지만 출력 형식은 상이함을 알립니다.
메시지가 에러인 경우
예시 상황
logger.error(newError('test'))
TEXT
기대한 내용
[2023-12-14 16:51:26][error]: test {
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:59:16)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:71:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)",
"deployment": "dev"
}
실제 내용
[2023-12-14 17:40:45][error]: test {
"deployment": "dev"
}
JSON
기대한 내용
{
"deployment": "dev",
"level": "error",
"message": "test",
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:59:16)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:71:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)",
"timestamp": "2023-12-14 16:52:15"
}
TEXT 에서는 에러의 메시지만 출력되고 stack 이 없는 채로 출력됨. JSON 형식에서는 에러 정보가 완전히 누락된 채로 출력됨.
메타 정보가 에러인 경우
예시 상황
logger.error('meta include error',newError('test'));
TEXT
기대한 내용
[2023-12-14 16:57:16][error]: meta include error test {
"deployment": "dev",
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:59:38)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:71:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)"
}
실제 내용
[2023-12-14 17:43:33][error]: meta include error test {
"deployment": "dev",
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:62:38)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:82:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)"
}
JSON
기대한 내용
{
"deployment": "dev",
"level": "error",
"message": "meta include error test",
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:59:38)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:71:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)",
"timestamp": "2023-12-14 16:53:48"
}
실제 내용
{
"deployment": "dev",
"level": "error",
"message": "meta include error test",
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:62:38)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:82:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)",
"timestamp": "2023-12-14 17:42:25"
}
비교 결과
TEXT 및 JSON 형식 모두 기대한대로 에러가 포함되어서 출력됨.
메타 정보의 어트리뷰트가 에러를 포함하고 있는 오브젝트인 경우
예시 상황
logger.error('attribute in meta include error',{error: newError('test')});
TEXT
기대한 내용
[2023-12-14 17:45:56][error]: attribute in meta include error test {
"deployment": "dev",
"error": {
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:62:50)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:82:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)"
}
}
실제 내용
[2023-12-14 17:39:12][error]: attribute in meta include error {
"deployment": "dev",
"error": {}
}
JSON
기대한 내용
{
"deployment": "dev",
"level": "error",
"message": "attribute in meta include error test",
"error": {
"stack": "Error: test\n at main (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:62:50)\n at Object.<anonymous> (/Users/gimseong-won/coding/Mr.C/api/src/main.ts:82:3)\n at Module._compile (node:internal/modules/cjs/loader:1254:14)\n at Module.m._compile (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1618:23)\n at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n at Object.require.extensions.<computed> [as .ts] (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/index.ts:1621:12)\n at Module.load (node:internal/modules/cjs/loader:1117:32)\n at Function.Module._load (node:internal/modules/cjs/loader:958:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n at phase4 (/Users/gimseong-won/coding/Mr.C/api/node_modules/ts-node/src/bin.ts:649:14)"
},
"timestamp": "2023-12-14 17:48:01"
}
실제 내용
{
"deployment": "dev",
"error": {},
"level": "error",
"message": "attribute in meta include error",
"timestamp": "2023-12-14 17:37:18"
}
비교 결과
TEXT 및 JSON 형식 모두 에러가 비어있는 객체로 출력됨.
The text was updated successfully, but these errors were encountered:
문제 상황
logger
에서Error
객체를 empty object 로 출력하고 있음.logger
를 구현하기 위해 사용한winston
에서Error
객체를 핸들링하는데 문제가 있는 것으로 확인. 관련 이슈비교 케이스
Note
출력 예시는 가독성을 위해 출력 내용을 다듬은 내용입니다. 데이터는 동일하지만 출력 형식은 상이함을 알립니다.
메시지가 에러인 경우
예시 상황
TEXT
기대한 내용
실제 내용
JSON
기대한 내용
실제 내용
비교 결과
TEXT 에서는 에러의 메시지만 출력되고 stack 이 없는 채로 출력됨. JSON 형식에서는 에러 정보가 완전히 누락된 채로 출력됨.
메타 정보가 에러인 경우
예시 상황
TEXT
기대한 내용
실제 내용
JSON
기대한 내용
실제 내용
비교 결과
TEXT 및 JSON 형식 모두 기대한대로 에러가 포함되어서 출력됨.
메타 정보의 어트리뷰트가 에러를 포함하고 있는 오브젝트인 경우
예시 상황
TEXT
기대한 내용
실제 내용
JSON
기대한 내용
실제 내용
비교 결과
TEXT 및 JSON 형식 모두 에러가 비어있는 객체로 출력됨.
The text was updated successfully, but these errors were encountered: