Log
Various logging utilities that are only used in the dev environment.
Supports all console.*
functions (log, trace, warn, error).
Usage
Alternative logging functions, or drop-in replacement for console.log
, but without having to remove them before moving to prod.
<script>
import { log, error } from 'svu/app'; // use as separate functions
import { console } from 'svu/app'; // use as drop-in replacement
</script>
<button on:click={() => log('log')}>log</button>
<button on:click={() => console.info('info')}>info</button>
<button on:click={() => error('error')}>error</button>
Functions
log()
- wrapsconsole.log()
trace()
- wrapsconsole.trace()
debug()
- wrapsconsole.debug()
info()
- wrapsconsole.info()
warn()
- wrapsconsole.warn()
error()
- wrapsconsole.error()
assert()
- wrapsconsole.assert()
count()
- wrapsconsole.count()
countReset()
- wrapsconsole.countReset()
dir()
- wrapsconsole.dir()
dirxml()
- wrapsconsole.dirxml()
clear()
- wrapsconsole.clear()
Caveats
When using the drop-in replacement, currently some console functions (group*
, profile*
, screenshot
, time*
, takeHeapSnapshot
) are not available.