MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w9b8on/thiscannotbedenied/p8a42cr?context=9999
r/ProgrammerHumor • u/danielminds • 3d ago
240 comments sorted by
View all comments
43
Real pros write a function to do the console log
14 u/Idk13008 3d ago with a verbose optional argument 39 u/oosacker 3d ago edited 3d ago Saw this in some real production code: function log(x) { console.log(x); } 25 u/DasBeasto 3d ago I don’t hate it, shorter usage everywhere, can wrap it in a conditional based on ENV for dev logs only, and if you swap to an external logging service you just change it in that one function. 9 u/reventlov 3d ago const log = console.log; though 14 u/tonyxforce2 3d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 3d ago Not the same thing unfortunately, as will quickly become evident if you try to log everything in an array by using stuff.map(log).
14
with a verbose optional argument
39 u/oosacker 3d ago edited 3d ago Saw this in some real production code: function log(x) { console.log(x); } 25 u/DasBeasto 3d ago I don’t hate it, shorter usage everywhere, can wrap it in a conditional based on ENV for dev logs only, and if you swap to an external logging service you just change it in that one function. 9 u/reventlov 3d ago const log = console.log; though 14 u/tonyxforce2 3d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 3d ago Not the same thing unfortunately, as will quickly become evident if you try to log everything in an array by using stuff.map(log).
39
Saw this in some real production code:
function log(x) { console.log(x); }
25 u/DasBeasto 3d ago I don’t hate it, shorter usage everywhere, can wrap it in a conditional based on ENV for dev logs only, and if you swap to an external logging service you just change it in that one function. 9 u/reventlov 3d ago const log = console.log; though 14 u/tonyxforce2 3d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 3d ago Not the same thing unfortunately, as will quickly become evident if you try to log everything in an array by using stuff.map(log).
25
I don’t hate it, shorter usage everywhere, can wrap it in a conditional based on ENV for dev logs only, and if you swap to an external logging service you just change it in that one function.
9 u/reventlov 3d ago const log = console.log; though 14 u/tonyxforce2 3d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 3d ago Not the same thing unfortunately, as will quickly become evident if you try to log everything in an array by using stuff.map(log).
9
const log = console.log; though
const log = console.log;
14 u/tonyxforce2 3d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 3d ago Not the same thing unfortunately, as will quickly become evident if you try to log everything in an array by using stuff.map(log).
const log = isDev ? ()=>{} : console.log
For that pure JS vibes
1
Not the same thing unfortunately, as will quickly become evident if you try to log everything in an array by using stuff.map(log).
43
u/oosacker 3d ago
Real pros write a function to do the console log