diff options
author | stephan <stephan@noemail.net> | 2022-09-19 09:58:01 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-09-19 09:58:01 +0000 |
commit | 509f40526e97c321720b3cf3430f8a4361e8e547 (patch) | |
tree | 4dc5142ff3ff4ec6a7c9e744150adf719e1b2e55 /ext/wasm/sqlite3-opfs-async-proxy.js | |
parent | 862281fc47187e37b10c1fbd46250de23ebef452 (diff) | |
download | sqlite-509f40526e97c321720b3cf3430f8a4361e8e547.tar.gz sqlite-509f40526e97c321720b3cf3430f8a4361e8e547.zip |
Generic cleanups in the OPFS VFS proxies.
FossilOrigin-Name: 7d5f6adc3b964413fc96ad8d2735312c3e58348024cabdd2099682cbf696eaf7
Diffstat (limited to 'ext/wasm/sqlite3-opfs-async-proxy.js')
-rw-r--r-- | ext/wasm/sqlite3-opfs-async-proxy.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ext/wasm/sqlite3-opfs-async-proxy.js b/ext/wasm/sqlite3-opfs-async-proxy.js index 3ae6af043..7eb12425c 100644 --- a/ext/wasm/sqlite3-opfs-async-proxy.js +++ b/ext/wasm/sqlite3-opfs-async-proxy.js @@ -49,18 +49,20 @@ const state = Object.create(null); */ state.verbose = 2; -const __logPrefix = "OPFS asyncer:"; -const log = (...args)=>{ - if(state.verbose>2) console.log(__logPrefix,...args); +const loggers = { + 0:console.error.bind(console), + 1:console.warn.bind(console), + 2:console.log.bind(console) }; -const warn = (...args)=>{ - if(state.verbose>1) console.warn(__logPrefix,...args); -}; -const error = (...args)=>{ - if(state.verbose) console.error(__logPrefix,...args); +const logImpl = (level,...args)=>{ + if(state.verbose>level) loggers[level]("OPFS asyncer:",...args); }; +const log = (...args)=>logImpl(2, ...args); +const warn = (...args)=>logImpl(1, ...args); +const error = (...args)=>logImpl(0, ...args); -warn("This file is very much experimental and under construction.",self.location.pathname); +warn("This file is very much experimental and under construction.", + self.location.pathname); /** Map of sqlite3_file pointers (integers) to metadata related to a @@ -82,7 +84,7 @@ const getResolvedPath = function(filename,splitIt){ filename, 'file://irrelevant' ).pathname; return splitIt ? p.split('/').filter((v)=>!!v) : p; -} +}; /** Takes the absolute path to a filesystem element. Returns an array |