chore(): update default logger examples
This commit is contained in:
@@ -29,14 +29,14 @@ const restClient = new RestClientV5({
|
||||
// Optional, uncomment the "silly" override to log a lot more info about what the WS client is doing
|
||||
const customLogger = {
|
||||
...DefaultLogger,
|
||||
// silly: (...params) => console.log('trace', ...params),
|
||||
// trace: (...params) => console.log('trace', ...params),
|
||||
};
|
||||
|
||||
const wsClient = new WebsocketClient(
|
||||
{
|
||||
key: key,
|
||||
secret: secret,
|
||||
market: 'v5',
|
||||
|
||||
/**
|
||||
* Set this to true to enable demo trading for the private account data WS
|
||||
* Topics: order,execution,position,wallet,greeks
|
||||
|
||||
@@ -46,10 +46,10 @@ const restClient = new RestClientV5({
|
||||
},
|
||||
});
|
||||
|
||||
// Optional, uncomment the "silly" override to log a lot more info about what the WS client is doing
|
||||
// Optional, uncomment the "trace" override to log a lot more info about what the WS client is doing
|
||||
const customLogger = {
|
||||
...DefaultLogger,
|
||||
// silly: (...params) => console.log('trace', ...params),
|
||||
// trace: (...params) => console.log('trace', ...params),
|
||||
};
|
||||
|
||||
const wsClient = new WebsocketClient(
|
||||
|
||||
@@ -4,10 +4,10 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src';
|
||||
// or
|
||||
// import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from 'bybit-api';
|
||||
|
||||
// Create & inject a custom logger to disable the silly logging level (empty function)
|
||||
// Create & inject a custom logger to enable the trace logging level (empty function)
|
||||
const logger = {
|
||||
...DefaultLogger,
|
||||
silly: () => {},
|
||||
// trace: (...params) => console.log('trace', ...params),
|
||||
};
|
||||
|
||||
const key = process.env.API_KEY;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src';
|
||||
|
||||
const logger = {
|
||||
...DefaultLogger,
|
||||
silly: (...params) => console.log('silly', ...params),
|
||||
trace: (...params) => console.log('trace', ...params),
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -17,13 +17,7 @@ const logger = {
|
||||
* - Heartbeats/ping/pong/reconnects are all handled automatically.
|
||||
* If a connection drops, the client will clean it up, respawn a fresh connection and resubscribe for you.
|
||||
*/
|
||||
const wsClient = new WebsocketClient(
|
||||
{
|
||||
// Previously required, this parameter is now optional:
|
||||
// market: 'v5',
|
||||
},
|
||||
logger,
|
||||
);
|
||||
const wsClient = new WebsocketClient({}, logger);
|
||||
|
||||
wsClient.on('update', (data) => {
|
||||
console.log('raw message received ', JSON.stringify(data));
|
||||
|
||||
Reference in New Issue
Block a user