File tree Expand file tree Collapse file tree 4 files changed +37
-3
lines changed
Expand file tree Collapse file tree 4 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @graphql-hive/core ' : minor
3+ ' @graphql-hive/apollo ' : minor
4+ ' @graphql-hive/cli ' : minor
5+ ' @graphql-hive/envelop ' : minor
6+ ---
7+
8+ Introduce debug log level. HTTP retry log pollute the error log. The retries are now logged to the debug level.
9+ In order to see debug logs set the ` debug ` option to true.
10+
11+ ``` ts
12+ const hive = createHive ({
13+ debug: true ,
14+ })
15+ ```
16+
17+ If you are using a custom logger, make sure to provide a ` debug ` logging method implementation.
18+
19+ ``` ts
20+ const hive = createHive ({
21+ debug: true ,
22+ agent: {
23+ logger: {
24+ info() {},
25+ error() {},
26+ debug() {}
27+ }
28+ }
29+ })
30+ ```
Original file line number Diff line number Diff line change @@ -221,11 +221,15 @@ export default abstract class BaseCommand<T extends typeof Command> extends Comm
221221 }
222222 } ,
223223 error : ( ...args ) => {
224- // Allow retrying requests without noise
225224 if ( isDebug ) {
226225 this . logWarning ( ...args ) ;
227226 }
228227 } ,
228+ debug : ( ...args ) => {
229+ if ( isDebug ) {
230+ this . logInfo ( ...args ) ;
231+ }
232+ } ,
229233 } ,
230234 headers : requestHeaders ,
231235 timeout : args . timeout ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { createPersistedDocuments } from './persisted-documents.js';
1010import { createReporting } from './reporting.js' ;
1111import type { HiveClient , HiveInternalPluginOptions , HivePluginOptions } from './types.js' ;
1212import { createUsage } from './usage.js' ;
13- import { createHiveLogger , isLegacyAccessToken , logIf } from './utils.js' ;
13+ import { createHiveLogger , isLegacyAccessToken } from './utils.js' ;
1414
1515export function createHive ( options : HivePluginOptions ) : HiveClient {
1616 const logger = createHiveLogger ( options ?. agent ?. logger ?? console , '[hive]' , options . debug ) ;
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export async function makeFetchCall(
127127 } ) . catch ( ( error : unknown ) => {
128128 const logErrorMessage = ( ) =>
129129 logger ?. debug ?.(
130- `${ config . method } ${ endpoint } (x-request-id=${ requestId } ) failed ${ getDuration ( ) } . ` +
130+ `${ config . method } ${ endpoint } (x-request-id=${ requestId } ) failed ${ getDuration ( ) } .` +
131131 getErrorMessage ( error ) ,
132132 ) ;
133133
You can’t perform that action at this time.
0 commit comments