[HN Gopher] Structured logs are the way to start
       ___________________________________________________________________
        
       Structured logs are the way to start
        
       Author : gianarb
       Score  : 22 points
       Date   : 2024-06-24 08:32 UTC (2 days ago)
        
 (HTM) web link (shippingbytes.com)
 (TXT) w3m dump (shippingbytes.com)
        
       | m-a-r-c-e-l wrote:
       | IMO manual logging and especially being consistent is hard in a
       | team. Language skills, cultural background, personal preferences,
       | etc.
       | 
       | Much better is a well thought of error handling. This shows
       | exactly when and where something went wrong. If your error
       | handler supports it, even context information like all the
       | variables of the current stack is reported.
       | 
       | Add managable background jobs to the recipe which you can restart
       | after fixing the code...
       | 
       | This helps in 99.99% of all cases.
        
         | gianarb wrote:
         | Ciao! This is all gold thank for sharing! I agree that
         | consistency is the key. But it is the key in many fields this
         | is why well-designed abstractions or continuous integration
         | exists. To enforce consistency.
         | 
         | Error handling as well can be very helpful to communicate what
         | your system is doing, but errors are not the only state you
         | want to look for.
         | 
         | In theory, but it is something that I didn't see used too much
         | a logging library can be wrapped into an abstraction where
         | useful to enforce consistency. For example if wrap your library
         | in something that conventionally sounds like "ThisLoggerIsCriti
         | calDontMoveItAsYouWillDoWithOtherLogs(logger)" you are
         | communicating something more about how that.
        
       | tail_exchange wrote:
       | Contextual logging makes structured logging even more powerful.
       | For example, you can attach an ID to the contex of an http
       | request when you receive it, which then gets logged in every
       | operation that is performed for serving that request. If you are
       | investigating what happened for a specific request, then you can
       | just search for its ID.
       | 
       | This works with any repeatable task and identifier, like runs of
       | a cron job, and user ids.
        
         | ManuelKiessling wrote:
         | Adding userId, clientId, sessionId, and requestId to every log
         | line and every event in the data warehouse is one of those
         | ,,one weird tricks" that actually does improve your life.
        
           | bigmattystyles wrote:
           | Until GDPR comes for you.
        
       ___________________________________________________________________
       (page generated 2024-06-26 23:00 UTC)