dhowe / AdNauseam-chrome

A Chrome extension to help defend against surveillance and tracking by ad-networks
19 stars 6 forks source link

Logger #3

Open dhowe opened 9 years ago

dhowe commented 9 years ago

A simple logger that writes JSON-formatted messages to a file (generally adnauseam.log, which it should create if not existing). It should have functions like:

Logger.log(); // should take msg, object or multiple of either Logger.warn(); // should take msg, exception or both Logger.err(); // should take msg, exception or both Logger.dispose(); // cleanup the logger on shutdown Logger.deleteLog();

CyrusSUEN commented 9 years ago

Extensions of Google Chrome cannot make log files writes on the file systems. Using HTML5 Filesystem API can only access to a virtual file system.

Apps of Google Chrome can directly write to the user's filesystem (e.g. ~/Documents or %USERPROFILE%\Documents), specified by the user using chrome.fileSystem API. But it is only available to Google Chrome apps not extensions.

But we have a work-around: use localStorage for keeping the log and then send all of the strings to some server when the user wants to export them into a file and respond with a log file download (or through chrome.downloads API)

And I could not find any Google Chrome extensions supporting log file. The closest one I found is still using console.log method for debugging use: capture

Ref:  How can a Chrome extension save many files to a user-specified directory?  Can extension write log-files?

CyrusSUEN commented 9 years ago

Perhaps we can try something like this: add an option on the extension to report problematic webpages http://support.getadblock.com/kb/im-seeing-an-ad/report-an-ad-to-us

dhowe commented 9 years ago

Perhaps? http://stackoverflow.com/questions/5442856/unable-to-log-continously-to-my-local-file-help-anyone?rq=1

CyrusSUEN commented 9 years ago

I believe it can only write to a sandboxed file system. http://caniuse.com/#feat=filesystem

rsudama commented 9 years ago

If the purpose of this is to facilitate development and debugging, perhaps the best thing would be to just write to the Chrome console (console.log()).