Modern Python logging

  Рет қаралды 141,780

mCoding

mCoding

Күн бұрын

A logging tutorial.
At some point, print statements aren't enough. When that time comes in Python, you should reach for the builtin logging package. It may be old (committed in 2002!), but it is the standard in Python. Unfortunately though, it being so old means that it's full of stuff you shouldn't use, it doesn't follow modern conventions like PEP8 coding style, and many tutorials are vastly outdated. If you'd like to understand the modern picture of logging in Python, then this video is for you.
― mCoding with James Murphy (mcoding.io)
Source code: github.com/mCodingLLC/VideosS...
logging docs: docs.python.org/3/library/log...
Make your own diagrams: excalidraw.com/
Local Elevator by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. creativecommons.org/licenses/...
SUPPORT ME ⭐
---------------------------------------------------
Sign up on Patreon to get your donor role and early access to videos!
/ mcoding
Feeling generous but don't have a Patreon? Donate via PayPal! (No sign up needed.)
www.paypal.com/donate/?hosted...
Want to donate crypto? Check out the rest of my supported donations on my website!
mcoding.io/donate
Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, Neel R, Matt R, Johan A, Casey G, Mark M, Mutual Information, Pi
BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord: / discord
Github: github.com/mCodingLLC/
Reddit: / mcoding
Facebook: / james.mcoding
CHAPTERS
---------------------------------------------------
0:00 Intro
0:34 Self-sponsorship
0:48 logging is the standard
1:21 basicConfig
2:08 dictConfig
2:44 the complete logging picture
7:51 Example: log to stdout
9:37 logging JSON/YAML config
10:44 Example: errors to stdedd and all to file
12:37 JSON logs
15:46 Extra context with the extra param
16:13 Custom filter
17:10 A glaring flaw
17:44 Log off the main thread with QueueHandler
19:15 Success!
19:26 Library logging?
20:16 logging4p
21:02 Thanks!

Пікірлер: 299
@megaing1322
@megaing1322 3 ай бұрын
That "include the timezone, *trust me*" has some history... xD
@hemerythrin
@hemerythrin 3 ай бұрын
"If you trust your users to do that kind of thing... *silent head shake*"
@Jakub1989YTb
@Jakub1989YTb 3 ай бұрын
Working with time is the worst :D *trust me*. HAving users in another timezone... I'd rather write them a whole separate app :D
@Naej7
@Naej7 3 ай бұрын
Don’t use timezones, put everything in UTC
@playerguy2
@playerguy2 3 ай бұрын
While I never had this issue before, the first time I hand-rolled a logging system for a small service _I was later glad I had the foresight to include the offset from UTC._
@playerguy2
@playerguy2 3 ай бұрын
​@@hemerythrintrust users? Buddy, I don't trust myself.
@thisoldproperty
@thisoldproperty 3 ай бұрын
Jeans down, this is the best python logging explanation I've ever seen. Brilliant work.
@threeme2189
@threeme2189 3 ай бұрын
I will start saying jeans down instead of hands down from this day on. It is, jeans down, the better of the two!
@hammerheadcorvette4
@hammerheadcorvette4 3 ай бұрын
Jeans Down?!
@greob
@greob 3 ай бұрын
⁠pants down
@VideoklipBG
@VideoklipBG 3 ай бұрын
pantsu down But seriously, this is genuinely the best guide I've seen and I'm working with Python regularly. I have been implementing logging very similarly, just without `dictConfig`. I didn't know you can specify custom classes like that. Only managed to set up stdout and file rotation one time then scrappted it because I don't want to waste time on logging.
@mCoding
@mCoding 3 ай бұрын
Agreed, we all say "jeans down" now.
@atrus3823
@atrus3823 3 ай бұрын
I’ve always found Python logging super opaque. After hours of reading and playing around, I still never really understood it. Somehow, in 20 minutes, you covered way more than I even knew was possible and it all makes so much sense now! Thank you! PS: Still waiting on your C++ value category video 🤞
@maxrinehart4177
@maxrinehart4177 3 ай бұрын
That why I love the old style programming youtubers, unlike the new programming influencers who react to articles and tech news. Mad respect for you James. ❤
@mCoding
@mCoding 3 ай бұрын
My only hesitation with value categories video is that I have to choose whether it will be slightly incorrect or slightly incomprehensible.
@atrus3823
@atrus3823 3 ай бұрын
​@@mCoding I'll accept either 😂. It's just another topic I struggle with, and you always have a way for making things understandable 🙏
@heroe1486
@heroe1486 Ай бұрын
@@maxrinehart4177Or straight up say nonsense and are closer to instagram influencers than actual devs, like a certain "blond" one, the problem is that there are some juniors listening to them
@maxrinehart4177
@maxrinehart4177 Ай бұрын
@@heroe1486 it's a disease, spilled out from instathots to wannabe programmers, the problem is the huge numbers of followers who watch this nonsense that bring no value. They bring nothing of value and it's a crime they are so popular and the actual competent tech youtubers are not. Not only the blonde one but that another guy called prime, he deleted my comments and banned me for saying his react videos bring no actual values.
@keslauche1779
@keslauche1779 3 ай бұрын
This channel is dangerously underrated
@penguindrummaster
@penguindrummaster 3 ай бұрын
As someone who owns a library, and rolled my own logger (in JavaScript), I appreciate the deep dive in proper logger design and methodology. I may not be able to use the examples here, but the lesson is well-received. As a self-taught developer, I missed a lot of the history in why things are written the way they are.
@DJStompZone
@DJStompZone 3 ай бұрын
You own a library? Nice! Do you have one of those rolling ladders to get to the high-up books?
@yxh
@yxh 2 ай бұрын
This is my favorite format of your videos so far. No memey images, just solid information with dry humor and guiding text peppered helpfully throughout. Great content as usual.
@djl3009
@djl3009 3 ай бұрын
The "complete logging picture" @02:44 is what I've been missing. Thank you!
@draufunddran
@draufunddran 3 ай бұрын
Wow... every python video from you is pure Gold. I'm only aware of one "recent" async video, but maybe you could do a more detailed video on async and await in python. I and certainly thousands of others would appreciate this. Keep up the awesome work!
@PBJYM
@PBJYM 3 ай бұрын
I've literally been trying to understand python logging for the past few days. This is easily the best video I've come across!
@Mathymagical
@Mathymagical 3 ай бұрын
I appreciate that you emphasized that the built-in logging library is the standard. Since there are some other competitors out there, it can be a bit confusing trying to evaluate whether to use the built-in or not. Thank you.
@ChrisJones-hv7mo
@ChrisJones-hv7mo 3 ай бұрын
This is a great deal better than other Python logging videos and tutorials that I have seen. They might cover the basics, but miss out pretty much entirely about information you need to know when you really want to get into logging with packages, subpackages, and user libraries, Thanks.
@pablofueros
@pablofueros 3 ай бұрын
A video like this was much needed in KZbin, thanks so much! I've learn some new things I can now work on
@69k_gold
@69k_gold 3 ай бұрын
The reason I love this channel and learned a lot from it is, James is one of the few programming content creators that have experience. Him saying "You know what works best for you" is an ironclad example for that
@alejandropinero8530
@alejandropinero8530 3 ай бұрын
This breakdown on the logger is truly amazing. One comment regarding the queue handler implementation 18:11 . This implementation only works, as is, on Python 3.12 as prior versions don't have that available for dictConfig.
@mCoding
@mCoding 3 ай бұрын
Thank you, and you are right. Users not yet on the current stable Python (3.12) may want to subclass QueueHandler, both to create the QueueListener as well as to start its thread automatically.
@jrat104
@jrat104 3 ай бұрын
@@mCodingI was looking forward to using this but i am stuck at 3.9 for reasons. Now to figure out how to do this
@Lanxxe
@Lanxxe 3 ай бұрын
Just introduced myself to the logging module a week back, nice coincidence you making this video
@bertjanbakker9497
@bertjanbakker9497 3 ай бұрын
Very very good. The explanation of the mental model is Gold! Finally a video that makes it simpler by showing the whole picture and what to skip instead of just showing the bare minimum which would leave you too ignorant to see both the the forrest and the trees.
@Jakub1989YTb
@Jakub1989YTb 3 ай бұрын
Thank you for this tutorial. Nothing new for me, but finally a nice comprehensive and modern approach. I totally agree with the statement "the tutorials are from people that are not using it". Sadly that's true for many other tutorials.
@user-er9ym7cy5w
@user-er9ym7cy5w 3 ай бұрын
pure gold! I been wanting to master the logging concepts for a long time now!
@SenukiQ
@SenukiQ 3 ай бұрын
Great video on standard library logging, but one thing to add is that I can recommend using library called structlog (for structured logs as name suggests), which are very useful especially for bigger applications, where we want to aggregate, store, parse and analyze logs on the system level. Structured logs are way easier to parse, thus analyze, so I think it's nice to have this library in your Python dev toolkit.
@richardcoppin5332
@richardcoppin5332 3 ай бұрын
Added to my reference library. This is invaluable. Thank you @mCoding.
@997Pancakes
@997Pancakes 2 ай бұрын
This is amazing content. Very concise and thorough, and you cover the concept in much greater depth than any other sources I've come across.
@omgwtfafterparty
@omgwtfafterparty 3 ай бұрын
When I started working with the logging module it seemed difficult to understand. But actually, after 2-3 hours I admired how powerful yet simple it turns out to be. Really, you plug it in and it just works.
@kacperkwasny3848
@kacperkwasny3848 3 ай бұрын
i love you. i didnt google for logging tutorial. I just watch your videos whenever there is a new on my main page
@AzinFiro
@AzinFiro 3 ай бұрын
For anyone interested in quick and dirty logging for debug purposes, there's also watchpoints, which lets you monitor any variable for changes.
@wchen2340
@wchen2340 2 ай бұрын
keep talking!
@AzinFiro
@AzinFiro 2 ай бұрын
@@wchen2340 rich.inspect()
@AzinFiro
@AzinFiro 2 ай бұрын
@@wchen2340 Use rich inspect() instead of print().
@amazingbanter
@amazingbanter 3 ай бұрын
structured logging gold. Thank you, Mr. Murphy!
@kevon217
@kevon217 3 ай бұрын
Best video on logging I’ve seen yet. Learned a lot, thanks!
@sambroderick5156
@sambroderick5156 3 ай бұрын
Excellent logging summary/best practices! Thank you so much!
@VarunSeth
@VarunSeth 3 ай бұрын
This is an incredibly valuable information. Since this is only applicable for applications and not libraries, this is not openly discussed anywhere nor available on Github. Thanks for sharing.
@jeroenvermunt3372
@jeroenvermunt3372 3 ай бұрын
I cannot overstate the value of this video. I was postponing e deep dive into logging, which I would have had this video sooner!
@JonathanHeavyside
@JonathanHeavyside 3 ай бұрын
Epic walkthrough. The standard logger has always been a bit of a black box and logs have always been a bit of an issue as my apps have grown. This is exactly what I needed.
@RandomAlexus
@RandomAlexus 3 ай бұрын
Animations are nice, but knowing that it's his hand dragging/dropping the graphics makes this intuitive to follow. Great subtlety of presentation.
@23wojtekk
@23wojtekk 3 ай бұрын
One of the best Python channels on KZbin, great tutorial
@siddharthsvnit
@siddharthsvnit 3 ай бұрын
you really have great content, and the detail in which you go to explain a concept is really appreciation worthy. thanks for these videos, they are really informative and helpful
@playea123
@playea123 3 ай бұрын
Loguru is straight up the best
@markasiala6355
@markasiala6355 3 ай бұрын
I recently found this as well. Great library.
@karserasl
@karserasl 3 ай бұрын
Also thread safe. There isnt any reason why you shouldn't use loguru everywhere
@dandan-gf4jk
@dandan-gf4jk 3 ай бұрын
lol my comment got deleted but this thread reads like those crypto scams😂
@marcbresson6548
@marcbresson6548 2 ай бұрын
@@karseraslactually there is. Loguru does not support multiple loggers. There is only one.
@vasudevmenon2496
@vasudevmenon2496 23 күн бұрын
I used a mix of print and logging in my application just to take quick look of what happened at a glance. Wasn't aware of json lines and queue handler. I had switched from standard json library to orjson to get considerable speedup when handling mixture of celery task uuid, objects, dates in different formats etc. Thanks for sharing
@chrishillery
@chrishillery 3 ай бұрын
Amazing, comprehensive, and clear. Thank you.
@CaptainCsaba
@CaptainCsaba 3 ай бұрын
Finally I understand Python logging. I really hope one day they actually create a better logging package. Every project needs logging and it should not be this difficult and outdated, especially when it comes to Python.
@youtubeenjoyer1743
@youtubeenjoyer1743 3 ай бұрын
Have you seen the most popular packages on pypi? It is full of libraries built with bad decisions, bad API design, bad programming practices, bad documentation. And recently it has gotten even worse, because now all code is either type hinted or not, and is written for asyncio or not. And these new async packages are going through all the same problems that were solved decades ago for the older packages. It’s a huge mess.
@italianphilosopher6571
@italianphilosopher6571 3 ай бұрын
It's Java-inspired. Difficulty, unobviousness and fussiness are a feature, not a bug.
@kotslike
@kotslike 3 ай бұрын
I salute you mister for enlightening us with this video. Thank you very much!
@Vijay-Yarramsetty
@Vijay-Yarramsetty 3 ай бұрын
this is geniusly explained of how to use rarely used logging
@willemvdk4886
@willemvdk4886 3 ай бұрын
This is a great condensed tutorial, respect! But, I do need to add that I don't really agree on the "one logger only" rule. In a lot of cases I have learned it's very valuable to seperate logging user activity from the technical logging. In a lot of applications you would want to log user activities for legal reasons and have the technical stuff for development reasons. I'm a big proponent of seperating the two. In most applications I've worked on we have a technical logger and an audit logger. They both log VERY different stuff and have different handlers and formatters. Technical stuff goes into files and sometimes email inboxes while the audit logs go into some elastic search cluster through a kafka bus just to make sure we have the persistence.
@dbreakiron
@dbreakiron 3 ай бұрын
This is, by far, the most clear and helpful explanation of Python logging I've ever seen. Thank you!
@jobjitdip6161
@jobjitdip6161 3 ай бұрын
Absolutely stellar work. Thank you!
@aeronesto
@aeronesto 2 ай бұрын
Very thorough! Thank you for putting this together! Well done!
@Rickety3263
@Rickety3263 3 ай бұрын
You had me cracking up. This is very relevant in what I’m working on right now. Gonna create a new boilerplate
@jesusromero9167
@jesusromero9167 Ай бұрын
Sometimes I don't understand a word you say, not because of your videos, but for the current knowledge I have. I still enjoyed your videos 😃
@quintencabo
@quintencabo 3 ай бұрын
Woah thanks for this amazing video. I never used to know what I was doing with python logging
@richisgood22
@richisgood22 Ай бұрын
Wow, this was an amazing tutorial... Thank you so much for making this!
@mCoding
@mCoding Ай бұрын
And thank you for watching!
@alexandredamiao1365
@alexandredamiao1365 Ай бұрын
I have learned a ton from this video and channel. Such high quality! Thank you!
@mCoding
@mCoding Ай бұрын
You're welcome!
@TboneIsRogue
@TboneIsRogue 3 ай бұрын
This is very nice. Extremely useful for out-of-the-box best practices for Python logging. I personally use "pip install loguru" for any projects I set up for logging, since it handles a lot of things automatically and removes so much boiletplate.
@josipsadek4425
@josipsadek4425 3 ай бұрын
Wow, this is super useful. I was looking for something like this for my setup
@DagarCoH
@DagarCoH 3 ай бұрын
When I started with the current professional work, I looked into Python logging, found many people frustrated, and wrote the logger myself. Normally I am not a fan of the DIY mentality in software, but I think I saved time this way and have what I need.
@this-one
@this-one 3 ай бұрын
This is some invaluable information. Thanks for the video.
@mCoding
@mCoding 3 ай бұрын
Glad you enjoyed it!
@pierreriandey6103
@pierreriandey6103 3 ай бұрын
Great quality videos, as always :) Thank you for the learning (and the entertainment, to be fair)
@6f6e69
@6f6e69 Ай бұрын
Pure gold. Thank you, sir!
@mCoding
@mCoding Ай бұрын
Much appreciated!
@seb2721
@seb2721 3 ай бұрын
So great to have content like this
@TonyHammitt
@TonyHammitt 3 ай бұрын
I like to also set up probabilistic trace logging, where some (usually small) portion of the work is logged end to end, with the portion changeable at runtime. If something doesn't seem right, being able to trace 1 of 10000 events can be really handy. That takes a bit more setup in the code, but it's super useful.
@AbdolaMike
@AbdolaMike 2 ай бұрын
this is amazing! thank you so much!
@UTl0l
@UTl0l 3 ай бұрын
Thx for a very good explanation of python logging. I've done this whole thing so many times at different companies, in different way. The queue handler was new to me however, I guess performance wasn't of that importance. One thing I would add is that while JSON format is great for programmatically parsing, I wouldn't say it's as human readable as colorized text. This is what I would use locally when developing and then use JSON when deployed.
@hidroman1993
@hidroman1993 3 ай бұрын
The acting on this video is impeccable
@jerrylu532
@jerrylu532 3 ай бұрын
thank you i finally understand it now, have been struggling with python logging since the start of my cs journey😂
@TotallyFred
@TotallyFred 3 ай бұрын
Best. Explanation. Ever. Thank you.
@mCoding
@mCoding 3 ай бұрын
You're very welcome!
@aliwelchoo
@aliwelchoo 3 ай бұрын
My team and I have recently been working with trying to get multiple loggers setup and deleting the old logs locally after some time. I'd say this is incredible timing but I'd be lying, having this massively useful video would have been even better last week! But still, thanks so much for sharing your expertise!
@mCoding
@mCoding 3 ай бұрын
Sounds like you need to hire us to do a code review! You're very welcome regardless.
@aliwelchoo
@aliwelchoo 3 ай бұрын
Code & architecture review I'd say! I'll definitely be seeing whether we can
@LorenzoPersichetti
@LorenzoPersichetti 3 ай бұрын
Best python logging video ever.
@joaopedrodonasolo680
@joaopedrodonasolo680 3 ай бұрын
Finished yesterday a one week long logging project. If only I had watched your video before that...
@colinmoon8097
@colinmoon8097 2 ай бұрын
Your video did set me on the right course for logging but it is far cleverer than what you showed,. PS I do watch your videos on most things as they are extremely helpful.
@hiraksarma3068
@hiraksarma3068 20 күн бұрын
Superb 👍this is pure value addtion, class apart from N numbers of videos showing ABC of Python endlessly.
@shkhamd
@shkhamd Ай бұрын
proper timestamps in logging is probably the most underrated element, until everyone realizes oh we are trying debug a multi-threading real time service.
@dmitrypalamarchuk3501
@dmitrypalamarchuk3501 3 ай бұрын
this is amazing, thank you!
@Master_of_Chess_Shorts
@Master_of_Chess_Shorts 2 ай бұрын
Very good and detailed, thanks
@greob
@greob 3 ай бұрын
Great video, with very valuable information. Thanks for sharing!
@mCoding
@mCoding 3 ай бұрын
Glad you enjoyed it!
@er63438
@er63438 24 күн бұрын
Really great video, thank you! On 20:00, it's worth mentioning that the default behavior, if I'm not mistaken, is for debug/info logs to go to stderr as well which I've always found unintuitive.
@mCoding
@mCoding 24 күн бұрын
Yeah, I've found that to be an unintuitive default as well. It goes against the principle of not using stderr as just an extra stream. It should really be just for errors as intended.
@etis398
@etis398 3 ай бұрын
This video is a gift from heaven 🎉 Thanks so lot for making such high quality content helping devs around the world write better code
@mCoding
@mCoding 3 ай бұрын
I appreciate your very kind praise 😅
@AI_For_Scientists
@AI_For_Scientists 3 ай бұрын
Excellent video, got a new subscriber.
@aaronm6675
@aaronm6675 3 ай бұрын
Wowwwwww, I'm immediately cloning and implementing in my app. THX🙏
@zyphtron
@zyphtron 3 ай бұрын
What are you really cloning?
@ytjho
@ytjho 2 ай бұрын
That deadpan headshake at 10:31 was great 😂
@bombase991
@bombase991 2 ай бұрын
18:04 Leaving a note here that QueueHandler config is only available in Python 3.12, according to the logging.config docs
@surisua16
@surisua16 3 ай бұрын
Awesome work! thank you a lot!!
@RedPsyched
@RedPsyched 3 ай бұрын
Not me watching the video and configuring my library logging bit by bit and then seeing the note at the end for libraries LMAO. Oh well, time to delete all that code. Great video though, definitely will use these tips in my Python apps.
@mCoding
@mCoding 3 ай бұрын
Whoops lol. 🤭
@HansStrijker
@HansStrijker 2 ай бұрын
Dude... I've been using logger since.... _years_ , and I had no notion of dictConfig's existence! Fair enough, I'm a DevOps/SysOps guy, so I pretty much only use the same handlers, stdout, stderr, and systemd-journald, which makes things easy enough to knock out, but still. Thanks! 🙂
@sqrt4788
@sqrt4788 3 ай бұрын
Great and concise content, did not know about dictconfig yet. Thanks! Around 08:40 you mention the weird format str syntax. As an alternative there is the style keyword which accepts "{", then the format str can be much more like fstrings.
@mCoding
@mCoding 3 ай бұрын
Great tip! I do tend to stick to the json approach, though! 😉
@Cookie-mv2hg
@Cookie-mv2hg 3 ай бұрын
You always managed to deep dive into the simplest thing and, voilà, I feel like I just learn python again. Great explanation!
@DJStompZone
@DJStompZone 3 ай бұрын
I felt the same way when python 3 came out.... Mostly just the part about learning python all over again
@Khushpich
@Khushpich 3 ай бұрын
Great video james
@slash_me
@slash_me 3 ай бұрын
Great video, I've been using logging for a while, but I might tune my setup with what I learned just now! I agree that yaml is very error prone (look up "Norway problem"), but I've also come to the conclusion that JSON is good for data exchange, but not for config files. For config, I've started using TOML. The syntax is a mix of JSON and .ini, but it's far less error prone than yaml, it has trailing commas, comments and can be read and written programmatically without losing formatting. Like yaml, it wasn't included in the stdlib, but there is now an implementation in Python 3.11+
@D0Samp
@D0Samp 3 ай бұрын
There's also JSON5 as an extension for human-writable JSON that allows such things as trailing commas in objects and lists, comments, single quote strings, hexadecimal numbers etc. For example, it's used for the configuration file of the Windows 11 terminal app. The JSON module in the Python library is only meant for serialization, however.
@robotnaoborot
@robotnaoborot 3 ай бұрын
Yeah as many mentioned I just use loguru too. It makes it really simpler without all the boilerplate which I couldn't remember even after years of using logging
@unperrier5998
@unperrier5998 3 ай бұрын
Thanks. One thing you could have mentionned is that a library developper could create a filter for his own logger(s).
@gabrielchaperon4068
@gabrielchaperon4068 3 ай бұрын
Hi! Fantastic video. What is you opinion on structlog, and how it could help avoid writing our own formatters?
@sonluuh
@sonluuh 3 ай бұрын
Nice tips for the Queue Handlers! Btw, be careful with thread-safe logging if you are using multi-thread inside your application
@Ca1vema
@Ca1vema 2 ай бұрын
The most basic concepts of python logging module people don't understand is that configuration of logging itself must be done by the end user, not frameworks or libraries, all what they suppose to do is to import logging, get logger and do logging calls.
@akhileshchander5307
@akhileshchander5307 3 ай бұрын
We were doing this way only except non-blocking Queue one. Thanks
@gloweye
@gloweye 3 ай бұрын
I remember having to explicitly murder a library's own logging config, because they were logging as plain text and we wanted everything as JSON. It was very annoying until I did some involved introspection on the logging system.
@mCoding
@mCoding 3 ай бұрын
Haha, what a vivid depiction, I've felt that pain, too.
@AtharvaRedij
@AtharvaRedij 2 ай бұрын
learned something new today
@player-eric
@player-eric 3 ай бұрын
Thanks sincerely for your brilliant video. I have a question that PyCharm seems not to have a good support for color display of the different levels for the logging module.
@sitrakamatthieu
@sitrakamatthieu 3 ай бұрын
HE IS BACK !!!
@ericklopez9754
@ericklopez9754 3 ай бұрын
Great video, can you do a video on "try except" code blocks; I believe its blurry for a lot of people who aren't working in the industry as far as HOW to use it in your coding project. For example, do you apply it to all of your code logic ? or conservatively ? An in-depth explanation and examples when you're working in industry and you're writing code how exactly would you apply it?, whats your thinking framework with it ??? Thank you very much for the quality content.
@JulienBorrel
@JulienBorrel 2 ай бұрын
Python logging is both brilliant and frighteningly complex.
@JulienDeneuville
@JulienDeneuville 3 ай бұрын
Wish I knew all this before creating my own logger!
@MikeprodOfficial
@MikeprodOfficial 14 күн бұрын
Just discovering this, I learnt a lot from your concise video. @mCoding What about using loguru instead of the default logging ?
@Lewstars
@Lewstars 2 ай бұрын
Hey. Really enjoyed actually understanding how logging works. I'm now a little confused about how far I need to go with logging for a somewhat basic ETL pipeline. It's not an overly complex application and doesn't have many moving parts. Based on the sample code, would '3-homework-filtered-stdout-stderr.json' be most appropriate?
@guidodinello1369
@guidodinello1369 3 ай бұрын
Hahaha i dont know why but the pause and face at 1:57 just cracked me up
@MichaelSchellerwayne
@MichaelSchellerwayne 3 ай бұрын
What about 10:30 :D
@PanduPoluan
@PanduPoluan 3 ай бұрын
One important thing you forgot to mention: logging.getLogger(logger_name) returns a singleton for each logger_name. The logic is kind of like: if logger_name not in dict_of_all_existing_loggers: dict_of_all_existing_loggers[logger_name] = LoggerClass() return dict_of_all_existing_loggers[logger_name] Or in other words: It's memoized This means, if you use multithreading or multiprocessing, you don't need to pass the logger instance to the worker threads/processes; rather, for each worker, have them fetch the singleton object by invoking logging.getLogger(logger_name).
Async for loops in Python
16:36
mCoding
Рет қаралды 54 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 298 М.
когда одна дома // EVA mash
00:51
EVA mash
Рет қаралды 11 МЛН
Кәріс тіріма өзі ?  | Synyptas 3 | 8 серия
24:47
kak budto
Рет қаралды 1,6 МЛН
INO IS A KIND ALIEN😂
00:45
INO
Рет қаралды 23 МЛН
Python Logging: How to Write Logs Like a Pro!
11:02
ArjanCodes
Рет қаралды 147 М.
super/MRO, Python's most misunderstood feature.
21:07
mCoding
Рет қаралды 209 М.
Loguru - Simplified Python Logging with Loguru!
28:56
Better Stack
Рет қаралды 2,2 М.
Asynchronous Web Apps in Python
15:30
mCoding
Рет қаралды 25 М.
Logging in Python: A Comprehensive Guide to Mastering It
30:46
Richard Schwabe
Рет қаралды 1,5 М.
All 39 Python Keywords Explained
34:08
Indently
Рет қаралды 64 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 83 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 915 М.
Is Python making Poetry REDUNDANT?!
9:22
Carberra
Рет қаралды 7 М.
Рекламная уловка Apple 😏
0:59
Яблык
Рет қаралды 807 М.
Any Sound & Call Recording Option Amazing Keypad Mobile 📱
0:48
Tech Official
Рет қаралды 326 М.