Last active
February 5, 2016 10:40
-
-
Save wheresrhys/bf93057ee3a594454582 to your computer and use it in GitHub Desktop.
console.log in legacy devices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app.js | |
app.get('/article/log', function (req, res, next) { | |
console.log.apply(console, ['------------------------------\nClient log:'].concat(JSON.parse(req.query.messages), ['\n------------------------------'])); | |
}); | |
// client.js | |
window.console = window.console || {}; | |
window.console.log = function (...messages) { | |
fetch && fetch(`/article/log?messages=${JSON.stringify(messages)}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment