dfinity / agent-js

A collection of libraries and tools for building software around the Internet Computer, in JavaScript.
https://agent-js.icp.xyz
Apache License 2.0
150 stars 95 forks source link

feat: introduces Observable Log for HttpAgent #842

Closed krpeacock closed 7 months ago

krpeacock commented 7 months ago

Description

The agent currently outputs console logs, warnings, and errors to the console.

This introduces an Observer pattern, available as a public ["log"] attribute which returns a new type of AgentLog. Developers can add listeners to hook into the logs, and a new flag (logToConsole) is provided, which will output these logs to the console.

This is turned off by default.

How Has This Been Tested?

new unit tests

Checklist:

github-actions[bot] commented 7 months ago

size-limit report 📦

Path Size
@dfinity/agent 100.18 KB (+0.31% 🔺)
@dfinity/candid 13.61 KB (0%)
@dfinity/principal 5.04 KB (0%)
@dfinity/auth-client 91.79 KB (+0.07% 🔺)
@dfinity/assets 91.96 KB (+0.03% 🔺)
@dfinity/identity 89.09 KB (+0.05% 🔺)
@dfinity/identity-secp256k1 263.22 KB (+0.14% 🔺)