Google Analytics SeRiOuSlY? Just create your own logging system :P

Sdílet
Vložit
  • čas přidán 7. 06. 2024
  • Monitor traffic to your websites without affecting performance by creating your own simple logging system.
    Please subscribe :P
    The website mentioned in the video is share.nnisarg.in
    Chapters -
    0:00 Intro
    1:17 How does logging work
    9:34 Code
    10:27 Bonus: keep bots away!
    11:06 Code cont.
    15:20 Results
    15:51 Outro
    Also checkout bug's channel: / @bugswriter_
    (he's my inspiration)
    I'm a Computer Engineering student, developer, Linux user (arch btw), open-source enthusiast and an existentialist :P
    I enjoy developing websites, but you can catch me working on other projects as well.
    Portfolio - nnisarg.in
    Blog - nnisarg.in/blog
    GitHub - nnisarg.in/github
    LinkedIn - nnisarg.in/linkedin
    Twitter - nnisarg.in/twitter
    Instagram - nnisarg.in/instagram
    Show your support for me at: nnisarg.in/support
    Send me an email at: contact@nnisarg.in
    Tags -
    #linux #webdev #coder #devloper #backend #frontend #python #analytics
  • Věda a technologie

Komentáře • 12

  • @siddheshlakhani4622
    @siddheshlakhani4622 Před 24 dny +1

    amazing!

  • @sarahsyed1423
    @sarahsyed1423 Před 24 dny

    Very helpful!

  • @rishikesh_prabhu
    @rishikesh_prabhu Před 24 dny

    Great video! Nice explanation

  • @piratesir4450
    @piratesir4450 Před 21 dnem

    Using some bg music to enhance the view span

  • @FelipeV3444
    @FelipeV3444 Před 20 dny

    I see a couple problems with this approach:
    1 - You load the entire log file in memory and close it, then add your new logs in memory, then you open the file again, write the whole thing, and close it again.
    -> What can happen here is that, if you have 2 requests comming in at the same time, both will take the same version of the file, add their own logs, and whichever process writes to the file first will have their log entry overwritten by the other one. Looks like you WILL lose logs with this approach.
    To fix this, you can instead open the file in append mode, no need to load it into memory and write the whole thing again, and also no need to open and close the file twice.
    ```
    with open("mylogfile.log", "a") as file:
    file.write("all my fancy logs

    • @nnisarggada
      @nnisarggada  Před 20 dny

      Thank you so much for the detailed information! I didn't (still don't) know much about logging and just tried my hand at a very simple approach. Although, I will definately look into the improvements you have mentioned and implement them. Once again thank you for not only pointing out the mistakes but also how to rectify them!

    • @FelipeV3444
      @FelipeV3444 Před 20 dny

      For sure! I guarantee mCoding's vid will be very insightful for you! :)

    • @nnisarggada
      @nnisarggada  Před 20 dny

      Gonna check it out asap :P