[{"data":1,"prerenderedAt":287},["ShallowReactive",2],{"term-l\u002Flogging":3,"related-l\u002Flogging":272},{"id":4,"title":5,"acronym":6,"body":7,"category":253,"description":254,"difficulty":255,"extension":256,"letter":257,"meta":258,"navigation":116,"path":259,"related":260,"seo":266,"sitemap":267,"stem":270,"subcategory":6,"__hash__":271},"terms\u002Fterms\u002Fl\u002Flogging.md","Logging",null,{"type":8,"value":9,"toc":247},"minimark",[10,15,19,23,26,30,236,240,243],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"Logging is writing a diary for your program. Every time something important happens — a user logs in, an error occurs, a payment is processed — you write it down with a timestamp. When something breaks at 3am, the logs are your only witness to what happened.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Logging is the practice of recording events, errors, and diagnostic information during program execution. Logs are structured with levels (DEBUG, INFO, WARN, ERROR, FATAL) to filter by severity. Production systems send logs to centralized services (Datadog, Loki, CloudWatch) for search, alerting, and analysis. Structured logging (JSON format) is preferred over plain text for machine parsing.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Basic console logging (development):\nconsole.log('User logged in:', userId);\nconsole.error('Payment failed:', error);\n\n\u002F\u002F Structured logging with a library (production):\nimport logger from '.\u002Flogger'; \u002F\u002F e.g. pino, winston\nlogger.info({ userId, action: 'login' }, 'User authenticated');\nlogger.error({ error, orderId }, 'Payment processing failed');\n","javascript","",[38,39,40,49,85,111,118,124,151,201],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F Basic console logging (development):\n",[41,50,52,56,60,64,67,70,74,76,79,82],{"class":43,"line":51},2,[41,53,55],{"class":54},"sTEyZ","console",[41,57,59],{"class":58},"sMK4o",".",[41,61,63],{"class":62},"s2Zo4","log",[41,65,66],{"class":54},"(",[41,68,69],{"class":58},"'",[41,71,73],{"class":72},"sfazB","User logged in:",[41,75,69],{"class":58},[41,77,78],{"class":58},",",[41,80,81],{"class":54}," userId)",[41,83,84],{"class":58},";\n",[41,86,88,90,92,95,97,99,102,104,106,109],{"class":43,"line":87},3,[41,89,55],{"class":54},[41,91,59],{"class":58},[41,93,94],{"class":62},"error",[41,96,66],{"class":54},[41,98,69],{"class":58},[41,100,101],{"class":72},"Payment failed:",[41,103,69],{"class":58},[41,105,78],{"class":58},[41,107,108],{"class":54}," error)",[41,110,84],{"class":58},[41,112,114],{"class":43,"line":113},4,[41,115,117],{"emptyLinePlaceholder":116},true,"\n",[41,119,121],{"class":43,"line":120},5,[41,122,123],{"class":47},"\u002F\u002F Structured logging with a library (production):\n",[41,125,127,131,134,137,140,143,145,148],{"class":43,"line":126},6,[41,128,130],{"class":129},"s7zQu","import",[41,132,133],{"class":54}," logger ",[41,135,136],{"class":129},"from",[41,138,139],{"class":58}," '",[41,141,142],{"class":72},".\u002Flogger",[41,144,69],{"class":58},[41,146,147],{"class":58},";",[41,149,150],{"class":47}," \u002F\u002F e.g. pino, winston\n",[41,152,154,157,159,162,164,167,170,172,176,179,181,184,186,189,191,194,196,199],{"class":43,"line":153},7,[41,155,156],{"class":54},"logger",[41,158,59],{"class":58},[41,160,161],{"class":62},"info",[41,163,66],{"class":54},[41,165,166],{"class":58},"{",[41,168,169],{"class":54}," userId",[41,171,78],{"class":58},[41,173,175],{"class":174},"swJcz"," action",[41,177,178],{"class":58},":",[41,180,139],{"class":58},[41,182,183],{"class":72},"login",[41,185,69],{"class":58},[41,187,188],{"class":58}," },",[41,190,139],{"class":58},[41,192,193],{"class":72},"User authenticated",[41,195,69],{"class":58},[41,197,198],{"class":54},")",[41,200,84],{"class":58},[41,202,204,206,208,210,212,214,217,219,222,225,227,230,232,234],{"class":43,"line":203},8,[41,205,156],{"class":54},[41,207,59],{"class":58},[41,209,94],{"class":62},[41,211,66],{"class":54},[41,213,166],{"class":58},[41,215,216],{"class":54}," error",[41,218,78],{"class":58},[41,220,221],{"class":54}," orderId ",[41,223,224],{"class":58},"},",[41,226,139],{"class":58},[41,228,229],{"class":72},"Payment processing failed",[41,231,69],{"class":58},[41,233,198],{"class":54},[41,235,84],{"class":58},[11,237,239],{"id":238},"when-youll-hear-this","When You'll Hear This",[16,241,242],{},"\"Check the logs for the error.\" \u002F \"Add a log statement before the API call so we can trace it.\"",[244,245,246],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":51,"depth":51,"links":248},[249,250,251,252],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":238,"depth":51,"text":239},"general","Logging is writing a diary for your program.","beginner","md","l",{},"\u002Fterms\u002Fl\u002Flogging",[261,262,263,264,265],"Debug","Error Handling","Monitoring","Stack Trace","Debugging",{"title":5,"description":254},{"changefreq":268,"priority":269},"weekly",0.7,"terms\u002Fl\u002Flogging","JPpXpj3P23N0krW1MQC8QU0ceuJLwvszHORfBFEev5A",[273,276,280,284],{"title":261,"path":274,"acronym":6,"category":253,"difficulty":255,"description":275},"\u002Fterms\u002Fd\u002Fdebug","Debugging is the process of finding and fixing the gremlins in your code. Something is broken, and you need to play detective — adding clues (console.",{"title":262,"path":277,"acronym":6,"category":253,"difficulty":278,"description":279},"\u002Fterms\u002Fe\u002Ferror-handling","intermediate","Error handling is the art of planning for things to go wrong and dealing with them gracefully instead of letting everything catch fire.",{"title":263,"path":281,"acronym":6,"category":282,"difficulty":255,"description":283},"\u002Fterms\u002Fm\u002Fmonitoring","cicd","Monitoring is keeping a constant eye on your app while it runs — tracking whether it's up, how fast it responds, how many errors it throws, and how much me...",{"title":264,"path":285,"acronym":6,"category":253,"difficulty":255,"description":286},"\u002Fterms\u002Fs\u002Fstack-trace","A stack trace is the error report that tells you exactly which functions were called right before your code crashed.",1776518293198]