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

PropertyTypeDescriptionDefined in
assert(value, message?, ...optionalParams) => voidWrites a message if the value is falsy, otherwise does nothingpackages/common/src/Console.ts:78
count(label?) => voidLogs the number of times this has been called with the given labelpackages/common/src/Console.ts:72
countReset(label?) => voidResets the counter for the given labelpackages/common/src/Console.ts:75
debug(...args) => voidOutputs a debug messagepackages/common/src/Console.ts:54
dir(object, options?) => voidDisplays an object's properties in a detailed formatpackages/common/src/Console.ts:66
enabled?booleanControls whether console methods produce output (default: true)packages/common/src/Console.ts:39
error(...args) => voidOutputs an error messagepackages/common/src/Console.ts:51
info(...args) => voidOutputs an informational message (often same as log)packages/common/src/Console.ts:45
log(...args) => voidOutputs a message to the consolepackages/common/src/Console.ts:42
table(tabularData, properties?) => voidDisplays tabular data as a tablepackages/common/src/Console.ts:69
time(label?) => voidStarts a timer with an optional labelpackages/common/src/Console.ts:57
timeEnd(label?) => voidEnds a timer and logs the elapsed timepackages/common/src/Console.ts:63
timeLog(label?, ...data) => voidLogs the elapsed time for a timer without ending itpackages/common/src/Console.ts:60
trace(message?, ...optionalParams) => voidPrints a stack trace with an optional messagepackages/common/src/Console.ts:81
warn(...args) => voidOutputs a warning messagepackages/common/src/Console.ts:48

Was this page helpful?