API reference / @evolu/common / Console / Console
Interface: Console
Defined in: packages/common/src/Console.ts:37
Console abstraction for Chrome 123+, Firefox 125+, Safari 18.1+, Node.js 22.x+, and React Native 0.75+. Includes methods guaranteed to be available in these environments and expected to remain compatible in future versions. Output formatting may vary (e.g., interactive UI in browsers vs. text in Node.js/React Native), but functionality is consistent across platforms.
Convention: Use a tag (e.g., [db]) as the first argument for log
filtering.
Example
deps.console.log("[evolu]", "createEvoluInstance", { name });
Tip: In browser dev tools, you can filter logs by tag (e.g., [db]) to
quickly find relevant messages. In Node.js, use grep to filter output:
node app.js | grep "\[relay\]" # Show only relay logs
node app.js | grep -E "\[db\]|\[sql\]" # Show db and sql logs
node app.js | grep -v "\[debug\]" # Hide debug logs
Or add to package.json scripts:
{
"scripts": {
"dev:relay": "node app.js | grep \"\\[relay\\]\"",
"dev:db": "node app.js | grep -E \"\\[db\\]|\\[sql\\]\""
}
}
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
assert | (value, message?, ...optionalParams) => void | Writes a message if the value is falsy, otherwise does nothing | packages/common/src/Console.ts:78 |
count | (label?) => void | Logs the number of times this has been called with the given label | packages/common/src/Console.ts:72 |
countReset | (label?) => void | Resets the counter for the given label | packages/common/src/Console.ts:75 |
debug | (...args) => void | Outputs a debug message | packages/common/src/Console.ts:54 |
dir | (object, options?) => void | Displays an object's properties in a detailed format | packages/common/src/Console.ts:66 |
enabled? | boolean | Controls whether console methods produce output (default: true) | packages/common/src/Console.ts:39 |
error | (...args) => void | Outputs an error message | packages/common/src/Console.ts:51 |
info | (...args) => void | Outputs an informational message (often same as log) | packages/common/src/Console.ts:45 |
log | (...args) => void | Outputs a message to the console | packages/common/src/Console.ts:42 |
table | (tabularData, properties?) => void | Displays tabular data as a table | packages/common/src/Console.ts:69 |
time | (label?) => void | Starts a timer with an optional label | packages/common/src/Console.ts:57 |
timeEnd | (label?) => void | Ends a timer and logs the elapsed time | packages/common/src/Console.ts:63 |
timeLog | (label?, ...data) => void | Logs the elapsed time for a timer without ending it | packages/common/src/Console.ts:60 |
trace | (message?, ...optionalParams) => void | Prints a stack trace with an optional message | packages/common/src/Console.ts:81 |
warn | (...args) => void | Outputs a warning message | packages/common/src/Console.ts:48 |