xpl / ololog

A better console.log for the log-driven debugging junkies
https://www.npmjs.com/package/ololog
The Unlicense
215 stars 8 forks source link

Vanilla JS? #28

Open bfalchuk opened 3 years ago

bfalchuk commented 3 years ago

newbie question - seeing unexpected error when using ololog as below. I include the lib like this: <script src="https://unpkg.com/ololog"></script> then i setup simply like this:

let log = ololog;
log.configure ({
  indent: { level: 3 },  //indent level
  locate:true,
  tag:true, //shows the 'iNFo' tag (or whatever) in front of msg
  time:false //timestamps
 });

but I see a console error on startup from the file get-source.js that i don't understand..

get-source.js:142 GET http://127.0.0.1:5500/index.html/ 404 (Not Found)
(anonymous) @ get-source.js:142
SyncPromise @ SyncPromise.js:9
fetchFileSync @ get-source.js:138
(anonymous) @ get-source.js:27
m @ get-source.js:17
SourceFile @ get-source.js:30
getSource @ get-source.js:113
withSource @ stacktracey.js:166
(anonymous) @ stacktracey.js:214
StackTracey.<computed> @ stacktracey.js:312
withSources @ stacktracey.js:214
clean @ stacktracey.js:237
locate @ ololog.js:119
modifiedFunctions.<computed> @ pipez.js:48
modifiedFunctions.<computed> @ pipez.js:48
(anonymous) @ pipez.js:23
Object.assign.configure @ pipez.js:23
(anonymous) @ logger.js:26
xpl commented 3 years ago

I haven't checked if it works for quite a while. Seems that it tries to fetch index.html (because your script is defined there) and then it fails for some reason. As a quick fix, setting locate: false might help.