Skip to content

Instantly share code, notes, and snippets.



Last active Feb 5, 2016
What would you like to do?
console.log in legacy devices
// 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