-
Notifications
You must be signed in to change notification settings - Fork 25
JSON based logger #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON based logger #642
Changes from all commits
3ed97fa
44d18a9
fdf2b26
a72f6a1
0a90acc
521ec45
3a8acc2
2dc4c18
a9da80c
067ab02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@graphql-hive/gateway-runtime': patch | ||
--- | ||
|
||
dependencies updates: | ||
|
||
- Added dependency [`@graphql-hive/logger-json@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger-json/v/workspace:^) (to `dependencies`) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
'@graphql-mesh/transport-http-callback': patch | ||
'@graphql-mesh/plugin-opentelemetry': patch | ||
'@graphql-mesh/fusion-runtime': patch | ||
'@graphql-mesh/transport-ws': patch | ||
'@graphql-hive/importer': patch | ||
'@graphql-hive/gateway': patch | ||
'@graphql-hive/gateway-runtime': patch | ||
'@graphql-hive/logger-json': patch | ||
--- | ||
|
||
New JSON-based logger | ||
|
||
By default, it prints pretty still to the console unless NODE_ENV is production. | ||
For JSON output, set the `LOG_FORMAT` environment variable to `json`. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,8 @@ | |
"vitest": "^3.0.1" | ||
}, | ||
"resolutions": { | ||
"@graphql-mesh/types": "0.103.16-alpha-20250212125252-6167fff12fe4017202b35363ff2769aafe28f98a", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update this before merging? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! |
||
"@graphql-mesh/utils": "0.103.16-alpha-20250212125252-6167fff12fe4017202b35363ff2769aafe28f98a", | ||
ardatan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"@graphql-tools/delegate": "workspace:^", | ||
"@opentelemetry/exporter-trace-otlp-http": "patch:@opentelemetry/exporter-trace-otlp-http@npm%3A0.56.0#~/.yarn/patches/@opentelemetry-exporter-trace-otlp-http-npm-0.56.0-dddd282e41.patch", | ||
"@opentelemetry/otlp-exporter-base": "patch:@opentelemetry/otlp-exporter-base@npm%3A0.56.0#~/.yarn/patches/@opentelemetry-otlp-exporter-base-npm-0.56.0-ba3dc5f5c5.patch", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
export const isDebug = ['1', 'y', 'yes', 't', 'true'].includes( | ||
String(process.env['DEBUG']), | ||
); | ||
export const isDebug = ['importer'].includes(String(process.env['DEBUG'])); | ||
|
||
export function debug(msg: string) { | ||
export function debug(message: string) { | ||
if (isDebug) { | ||
process.stderr.write(`[${new Date().toISOString()}] HOOKS ${msg}\n`); | ||
process.stderr.write( | ||
`${JSON.stringify({ | ||
name: 'importer', | ||
level: 'debug', | ||
message, | ||
})}\n`, | ||
); | ||
Comment on lines
+1
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Optional enhancement for debug condition and logging consistency.
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,56 @@ | ||||||||||||||||||||
{ | ||||||||||||||||||||
"name": "@graphql-hive/logger-json", | ||||||||||||||||||||
"version": "0.0.0", | ||||||||||||||||||||
"type": "module", | ||||||||||||||||||||
ardatan marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainMissing changeset file for the new package. According to the coding guidelines, a changeset file is required for new packages. Please create one using
Let me check if a changeset file exists: 🏁 Script executed: #!/bin/bash
# Look for changeset files
fd -e md . .changeset/ Length of output: 1716 Missing changeset file for @graphql-hive/logger-json package |
||||||||||||||||||||
"repository": { | ||||||||||||||||||||
"type": "git", | ||||||||||||||||||||
"url": "git+https://github.com/graphql-hive/gateway.git", | ||||||||||||||||||||
"directory": "packages/logger-json" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"author": { | ||||||||||||||||||||
"email": "[email protected]", | ||||||||||||||||||||
"name": "The Guild", | ||||||||||||||||||||
"url": "https://the-guild.dev" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"license": "MIT", | ||||||||||||||||||||
"engines": { | ||||||||||||||||||||
"node": ">=18.0.0" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"main": "./dist/index.js", | ||||||||||||||||||||
"exports": { | ||||||||||||||||||||
".": { | ||||||||||||||||||||
"require": { | ||||||||||||||||||||
"types": "./dist/index.d.cts", | ||||||||||||||||||||
"default": "./dist/index.cjs" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"import": { | ||||||||||||||||||||
"types": "./dist/index.d.ts", | ||||||||||||||||||||
"default": "./dist/index.js" | ||||||||||||||||||||
} | ||||||||||||||||||||
}, | ||||||||||||||||||||
"./package.json": "./package.json" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"types": "./dist/index.d.ts", | ||||||||||||||||||||
"files": [ | ||||||||||||||||||||
"dist" | ||||||||||||||||||||
], | ||||||||||||||||||||
"scripts": { | ||||||||||||||||||||
"build": "pkgroll --clean-dist", | ||||||||||||||||||||
"prepack": "yarn build" | ||||||||||||||||||||
}, | ||||||||||||||||||||
Comment on lines
+37
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Add test script to package.json. Consider adding a test script to ensure the logger functionality is properly tested: "scripts": {
"build": "pkgroll --clean-dist",
- "prepack": "yarn build"
+ "prepack": "yarn build",
+ "test": "jest"
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
"peerDependencies": { | ||||||||||||||||||||
"graphql": "^15.9.0 || ^16.9.0" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"dependencies": { | ||||||||||||||||||||
"@graphql-mesh/cross-helpers": "^0.4.10", | ||||||||||||||||||||
"@graphql-mesh/types": "^0.103.16", | ||||||||||||||||||||
"@graphql-mesh/utils": "^0.103.16", | ||||||||||||||||||||
"cross-inspect": "^1.0.1", | ||||||||||||||||||||
"tslib": "^2.8.1" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"devDependencies": { | ||||||||||||||||||||
"graphql": "^16.9.0", | ||||||||||||||||||||
"pkgroll": "2.8.2" | ||||||||||||||||||||
}, | ||||||||||||||||||||
"sideEffects": false | ||||||||||||||||||||
} | ||||||||||||||||||||
Comment on lines
+1
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify Linear issue and documentation requirements. According to the coding guidelines:
Let me check for documentation PRs: 🏁 Script executed: gh search prs --repo graphql-hive/console --json title,url --jq '.[] | select(.title | contains("logger") or contains("logging"))' Length of output: 389 Action Required: Address Missing Linear Issue and Documentation Update
Please update the PR description and/or commit messages to include a Linear issue reference and ensure that the console documentation is updated accordingly. |
Uh oh!
There was an error while loading. Please reload this page.