Skip to content

Commit

Permalink
Add a couple logging modifications (#155)
Browse files Browse the repository at this point in the history
- Configure log level with env var
- Don't log all account data on cache miss

Signed-off-by: Nathan LeClaire <nathan@cryptoworkbench.io>
  • Loading branch information
nathanleclaire authored Jul 2, 2022
1 parent e400ce9 commit 4a0986e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/main/preload.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
const { contextBridge, ipcRenderer } = require('electron');
const log = require('electron-log');
const promiseIpc = require('electron-promise-ipc');
// TODO: make this a setting...
log.transports.console.level = 'silly';
log.transports.ipc.level = 'silly';

if (process.env.LOG_LEVEL) {
log.transports.console.level = process.env.LOG_LEVEL;
log.transports.ipc.level = process.env.LOG_LEVEL;
} else {
log.transports.console.level = 'silly';
log.transports.ipc.level = 'silly';
}

const send = (method, msg) => {
ipcRenderer.send('main', method, msg);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/data/accounts/getAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function getAccount(
const key = new sol.PublicKey(pubKey);
const solAccount = await solConn.getAccountInfo(key);

logger.silly('getAccountInfo cache miss', pubKey, solAccount);
logger.silly('getAccountInfo cache miss', pubKey, key.toString());
// TODO: these should not be made individually, instead, toss them on a list, and make getMultipleAccounts call once every 333mS or something
// if (solAccount) {
const response: AccountInfo = {
Expand Down

0 comments on commit 4a0986e

Please sign in to comment.