Skip to content

Commit

Permalink
get rid of console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jul 15, 2024
1 parent 47a98ba commit 9d1b92f
Show file tree
Hide file tree
Showing 57 changed files with 146 additions and 146 deletions.
12 changes: 6 additions & 6 deletions examples/bitcoin/test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@ export async function startBitcoinDaemon(): Promise<BitcoinDaemon> {
}
});

console.log(`starting bitcoind...`);
console.info(`starting bitcoind...`);
await new Promise((resolve) => setTimeout(resolve, 5000));
return bitcoinDaemon;
}

export function createBitcoinWallet(wallets: Wallets): void {
console.log(' - create bitcoin wallet');
console.info(' - create bitcoin wallet');
bitcoinCli.createWallet();
Object.entries(wallets).forEach(([name, wallet]) => {
bitcoinCli.importPrivateKey(wallet.wif, name);
});
}

export async function mine101Blocks(wallets: Wallets): Promise<void> {
console.log(' - mine blocks');
console.info(' - mine blocks');
await bitcoinCli.generateToAddress(101, wallets.alice.p2wpkh);
}

export function getEarliestUtxo(): Utxo {
console.log(' - get earliest utxo');
console.info(' - get earliest utxo');
const utxos = bitcoinCli.listUnspent();
if (utxos.length === 0) {
throw "There aren't any UTXOs after mining 101 blocks. Something went wrong";
Expand All @@ -56,7 +56,7 @@ export function getEarliestUtxo(): Utxo {
}

export function createTransaction(from: Utxo, wallets: Wallets): string {
console.log(' - get create transaction');
console.info(' - get create transaction');
const input: TxInput = {
txid: from.txid,
vout: from.vout
Expand All @@ -69,6 +69,6 @@ export function createTransaction(from: Utxo, wallets: Wallets): string {
}

export function signTransaction(rawTransaction: string): string {
console.log(' - sign transaction');
console.info(' - sign transaction');
return bitcoinCli.signRawTransactionWithWallet(rawTransaction).hex;
}
2 changes: 1 addition & 1 deletion examples/bitcoin_psbt/scripts/bitcoin/transaction_count.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function getBlockTransactionCount() {
execSync(`${CLI} getblock ${blockHash}`).toString()
);
const transactionCount = blockInfo.tx.length;
console.log(
console.info(
`Block ${i} (${blockHash}) has ${transactionCount} transactions.`
);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ckbtc/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function startBitcoinDaemon(): Promise<BitcoinDaemon> {
}
});

console.log(`starting bitcoind...`);
console.info(`starting bitcoind...`);
await new Promise((resolve) => setTimeout(resolve, 5000));
return bitcoinDaemon;
}
Expand Down
8 changes: 4 additions & 4 deletions examples/ckbtc/wallet/frontend/elements/ck-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class CkApp extends LitElement {

const result = await this.walletBackend.getBalance();

console.log('getBalance', result);
console.info('getBalance', result);

this.balance = result;
}
Expand All @@ -110,7 +110,7 @@ export class CkApp extends LitElement {

const result = await this.walletBackend.getDepositAddress();

console.log('getBitcoinDepositAddress', result);
console.info('getBitcoinDepositAddress', result);

this.bitcoinDepositAddress = result;
}
Expand All @@ -125,7 +125,7 @@ export class CkApp extends LitElement {

const result = await this.walletBackend.updateBalance();

console.log('updateBalance', result);
console.info('updateBalance', result);

await this.getBalance();

Expand All @@ -150,7 +150,7 @@ export class CkApp extends LitElement {
this.transferAmount
);

console.log('transfer', result);
console.info('transfer', result);

await this.getBalance();

Expand Down
2 changes: 1 addition & 1 deletion examples/heartbeat/src/heartbeat_async/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default Canister({
const randomness = await getRandomness();

initialized = randomness;
console.log('heartbeat initialized', randomness.length);
console.info('heartbeat initialized', randomness.length);
}),
getInitialized: query([], blob, () => {
return initialized;
Expand Down
2 changes: 1 addition & 1 deletion examples/heartbeat/src/heartbeat_sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let initialized = false;
export default Canister({
heartbeat: heartbeat(() => {
initialized = true;
console.log('heartbeat initialized', initialized);
console.info('heartbeat initialized', initialized);
}),
getInitialized: query([], bool, () => {
return initialized;
Expand Down
2 changes: 1 addition & 1 deletion examples/inspect_message/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { bool, Canister, ic, inspectMessage, update } from 'azle/experimental';

export default Canister({
inspectMessage: inspectMessage(() => {
console.log('inspectMessage called');
console.info('inspectMessage called');

if (ic.methodName() === 'accessible') {
ic.acceptMessage();
Expand Down
2 changes: 1 addition & 1 deletion examples/internet_identity/test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getTests(canisterName: string): Test {

page.on('console', (message) => {
for (const arg of message.args()) {
console.log(`Puppetteer log: ${arg}`);
console.info(`Puppetteer log: ${arg}`);
}
});

Expand Down
2 changes: 1 addition & 1 deletion examples/motoko_examples/hello-world/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { Canister, query, Void } from 'azle/experimental';

export default Canister({
main: query([], Void, () => {
console.log('Hello World!');
console.info('Hello World!');
})
});
2 changes: 1 addition & 1 deletion examples/open_value_sharing/src/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ app.post('/test-long-running', async (req, res) => {
});

if (i % 1_000 === 0) {
console.log(`1_000 records inserted`);
console.info(`1_000 records inserted`);
}

if (i % 30_000 === 0) {
Expand Down
4 changes: 2 additions & 2 deletions examples/open_value_sharing/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export default Canister({
return payments;
}),
wallet_receive: update([Opt(ReceiveOptions)], Void, (_receiveOptions) => {
console.log('wallet_receive');
console.log(`cycles available: ${ic.msgCyclesAvailable()}`);
console.info('wallet_receive');
console.info(`cycles available: ${ic.msgCyclesAvailable()}`);

const callerInWhitelist = principalsWhitelist.includes(
ic.caller().toText()
Expand Down
6 changes: 3 additions & 3 deletions examples/pre_and_post_upgrade/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ let entries: {

export default Canister({
init: init([], () => {
console.log('init');
console.info('init');

stableStorage.insert('entries', []);
}),
postUpgrade: postUpgrade([], () => {
console.log('postUpgrade');
console.info('postUpgrade');

const stableEntriesOpt = stableStorage.get('entries');

Expand All @@ -47,7 +47,7 @@ export default Canister({
}, {});
}),
preUpgrade: preUpgrade(() => {
console.log('preUpgrade');
console.info('preUpgrade');

stableStorage.insert(
'entries',
Expand Down
40 changes: 20 additions & 20 deletions examples/primitive_types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,133 +26,133 @@ export default Canister({
return 'string';
}),
printString: query([text], text, (string) => {
console.log(typeof string);
console.info(typeof string);
return string;
}),
getText: query([], text, () => {
return 'text';
}),
printText: query([text], text, (text) => {
console.log(typeof text);
console.info(typeof text);
return text;
}),
getNumber: query([], float64, () => {
return Number.MAX_SAFE_INTEGER;
}),
printNumber: query([float64], float64, (number) => {
console.log(typeof number);
console.info(typeof number);
return number;
}),
getInt: query([], int, () => {
return 170_141_183_460_469_231_731_687_303_715_884_105_727n;
}),
printInt: query([int], int, (int) => {
console.log(typeof int);
console.info(typeof int);
return int;
}),
getInt64: query([], int64, () => {
return 9_223_372_036_854_775_807n;
}),
printInt64: query([int64], int64, (int64) => {
console.log(typeof int64);
console.info(typeof int64);
return int64;
}),
getInt32: query([], int32, () => {
return 2_147_483_647;
}),
printInt32: query([int32], int32, (int32) => {
console.log(typeof int32);
console.info(typeof int32);
return int32;
}),
getInt16: query([], int16, () => {
return 32_767;
}),
printInt16: query([int16], int16, (int16) => {
console.log(typeof int16);
console.info(typeof int16);
return int16;
}),
getInt8: query([], int8, () => {
return 127;
}),
printInt8: query([int8], int8, (int8) => {
console.log(typeof int8);
console.info(typeof int8);
return int8;
}),
getNat: query([], nat, () => {
return 340_282_366_920_938_463_463_374_607_431_768_211_455n;
}),
printNat: query([nat], nat, (nat) => {
console.log(typeof nat);
console.info(typeof nat);
return nat;
}),
getNat64: query([], nat64, () => {
return 18_446_744_073_709_551_615n;
}),
printNat64: query([nat64], nat64, (nat64) => {
console.log(typeof nat64);
console.info(typeof nat64);
return nat64;
}),
getNat32: query([], nat32, () => {
return 4_294_967_295;
}),
printNat32: query([nat32], nat32, (nat32) => {
console.log(typeof nat32);
console.info(typeof nat32);
return nat32;
}),
getNat16: query([], nat16, () => {
return 65_535;
}),
printNat16: query([nat16], nat16, (nat16) => {
console.log(typeof nat16);
console.info(typeof nat16);
return nat16;
}),
getNat8: query([], nat8, () => {
return 255;
}),
printNat8: query([nat8], nat8, (nat8) => {
console.log(typeof nat8);
console.info(typeof nat8);
return nat8;
}),
getFloat64: query([], float64, () => {
return Math.E;
}),
printFloat64: query([float64], float64, (float64) => {
console.log(typeof float64);
console.info(typeof float64);
return float64;
}),
getFloat32: query([], float32, () => {
return Math.PI;
}),
printFloat32: query([float32], float32, (float32) => {
console.log(typeof float32);
console.info(typeof float32);
return float32;
}),
getBool: query([], bool, () => {
return true;
}),
printBool: query([bool], bool, (bool) => {
console.log(typeof bool);
console.info(typeof bool);
return bool;
}),
getPrincipal: query([], Principal, () => {
return Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai');
}),
printPrincipal: query([Principal], Principal, (principal) => {
console.log(typeof principal);
console.info(typeof principal);
return principal;
}),
getNull: query([], Null, () => {
return null;
}),
printNull: query([Null], Null, (Null) => {
console.log(typeof Null);
console.info(typeof Null);
return Null;
}),
getReserved: query([], reserved, () => {
return 'anything';
}),
printReserved: query([reserved], reserved, (reserved) => {
console.log(typeof reserved);
console.info(typeof reserved);
return reserved;
}),
getEmpty: query([], empty, () => {
Expand All @@ -161,7 +161,7 @@ export default Canister({
// Note: It is impossible to call this function because it requires an argument
// but there is no way to pass an "empty" value as an argument.
printEmpty: query([empty], empty, (empty) => {
console.log(typeof empty);
console.info(typeof empty);
throw 'Anything you want';
})
});
2 changes: 1 addition & 1 deletion examples/robust_imports/src/azle_coverage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export const buyHoneydew = honeydew(() => {
});

export const keepIlamaClean = ilama(() => {
console.log(`Method "${lemon.methodName()}" was called`);
console.info(`Method "${lemon.methodName()}" was called`);
if (lemon.methodName() === 'dirtyIlama') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/robust_imports/src/ts_primitives/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const checkPrimAliases = query(
MyVoid,
(param1, param2, param3, param4, param5) => {
if (param1) {
console.log(`${param2}, ${param3}, ${param4}, ${param5}`);
console.info(`${param2}, ${param3}, ${param4}, ${param5}`);
}
}
);
6 changes: 3 additions & 3 deletions examples/robust_imports/src/type_alias_decls/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@ export const simpleDeepQuery = types.Deep$queryAlias(
[],
types.VoidAlias,
() => {
console.log(HELLO_WORLD);
console.info(HELLO_WORLD);
}
);

export const simpleAzleQuery = types.Azle$queryAlias(
[],
types.VoidAlias,
() => {
console.log(HELLO_WORLD);
console.info(HELLO_WORLD);
}
);

export const simpleQuery = types.$queryAlias([], types.VoidAlias, () => {
console.log(HELLO_WORLD);
console.info(HELLO_WORLD);
});

const AliasedCanister = types.DeepCanisterAlias({
Expand Down
Loading

0 comments on commit 9d1b92f

Please sign in to comment.