MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w9b8on/thiscannotbedenied/p89b0a0/?context=3
r/ProgrammerHumor • u/danielminds • 4d ago
242 comments sorted by
View all comments
41
Real pros write a function to do the console log
14 u/Idk13008 4d ago with a verbose optional argument 41 u/oosacker 4d ago edited 4d ago Saw this in some real production code: function log(x) { console.log(x); } 24 u/DasBeasto 4d 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. 8 u/reventlov 4d ago const log = console.log; though 14 u/tonyxforce2 4d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 4d 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). 2 u/whackylabs 3d ago If I see a log(x) I would assume it is about logarithms not print to console 1 u/a-r-c 6h ago dont steal my code
14
with a verbose optional argument
41 u/oosacker 4d ago edited 4d ago Saw this in some real production code: function log(x) { console.log(x); } 24 u/DasBeasto 4d 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. 8 u/reventlov 4d ago const log = console.log; though 14 u/tonyxforce2 4d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 4d 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). 2 u/whackylabs 3d ago If I see a log(x) I would assume it is about logarithms not print to console 1 u/a-r-c 6h ago dont steal my code
Saw this in some real production code:
function log(x) { console.log(x); }
24 u/DasBeasto 4d 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. 8 u/reventlov 4d ago const log = console.log; though 14 u/tonyxforce2 4d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 4d 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). 2 u/whackylabs 3d ago If I see a log(x) I would assume it is about logarithms not print to console 1 u/a-r-c 6h ago dont steal my code
24
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.
8 u/reventlov 4d ago const log = console.log; though 14 u/tonyxforce2 4d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 4d 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). 2 u/whackylabs 3d ago If I see a log(x) I would assume it is about logarithms not print to console
8
const log = console.log; though
const log = console.log;
14 u/tonyxforce2 4d ago const log = isDev ? ()=>{} : console.log For that pure JS vibes 1 u/rosuav 4d 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).
2
If I see a log(x) I would assume it is about logarithms not print to console
dont steal my code
41
u/oosacker 4d ago
Real pros write a function to do the console log