training.shoppinpal.com
  • Introduction
  • 1. The Ideal Workspace
    • The Perfect Machine
      • For Biz Team
      • For Developers
      • For Designers
    • Setup a machine in the cloud
      • Solution
      • Setup box on Azure
        • Create a machine on Azure
        • Test drive your remote machine
        • Setup Dropbox On Azure
      • Setup box on DigitalOcean
        • Setup UI
        • Shared FileSystem
          • Dropbox
            • Use locally developed node modules in another project
          • sshfs
        • Long Running Sessions
      • Feedback
  • 2. Learning Git
    • Static Code Analysis
  • 3. The Backend
    • Use Containers
    • Setup a loopback project
    • Lockdown
    • Build a better mousetrap
    • The abyss stares back
    • Built-in models
    • Extending built-in models
    • Understanding UserModel
    • Boot Scripts
    • Promises
    • Find roles for current user
    • Loopback Console
    • Current User
  • 4. Multi-tenancy With Loopback
    • What is Multi-Tenancy
    • Architecting with Loopback
    • Define scope for Roles
    • Role Resolvers
    • Access Control For Tenants
    • Better Programming with multi-tenancy
  • 5. The Frontend
    • The Browser
    • Unit Testing
      • Motivation behind this blog
      • How to write a test
      • Karma and Jasmin
      • Writing Tests
    • End-2-End Testing
    • Angular 1.x
    • Angular 2
      • Testing
  • 6. ElasticSearch
    • Better Search with NGram
    • NGram with Elasticsearch
    • Fun with Path Hierarchy Tokenizer
    • Working with Mappings and Analyzers
  • 7. Promises
    • What are Promises
    • Promise Implementations
    • Nuances
    • What should we use
  • 8. Learning Docker
    • Docker Swarm
  • 9. Queues & Workers
    • PHP workers in AWS EBS
    • NodeJS workers in AWS EBS
      • SQS Daemon by AWS
      • SQS Daemon in NodeJS
      • SQS polling by worker
    • Gearman
  • 10. Docker
    • Capabilities
  • Appendix
    • Bug in WebStorm deployments
    • The Perfect Terminal
    • Scalable App Deployment with AWS
    • Chrome Tips & Tricks
    • Host your own Gitbook
    • Gitbook Tips & Tricks
    • How to handle support incidents
    • Dev Resources
    • Debug e2e Tests on CircleCI
    • Logging
    • Authentication Principles
    • Mac
    • nvm
    • Unify testing with npm
      • Debugging Mocha
    • Sequence Diagrams
    • Project Sync via IDE
      • SFTP with WebStorm
      • SFTP with Visual Studio
    • Soft Linking
    • NodeJS Profiling
      • How to find node.js performance optimization killers
    • Setup Packer on Azure
Powered by GitBook
On this page
  • Key Lessons
  • Resources
  • Worth Exploring
  • Notes from Folks
  • By Pulkit Singhal:
  1. Appendix

Logging

PreviousDebug e2e Tests on CircleCINextAuthentication Principles

Last updated 7 years ago

Key Lessons

  1. Always log to stdout. It is not the application's responsibility to route logs.

  2. Never, ever log credentials, passwords or any sensitive information.

Resources

Worth Exploring

  1. - You can use any logger you want underneath it.

Notes from Folks

By :

I think I was able to crystallize what was bothering me about the state of logging in nodejs. Here are some high level use cases I'd like to see all mashed up and addressed by one library: 1. Turning off logging in modules for tests like mocha (doable with env flag and any log library) 2. Toggling logs in dependencies when troubleshooting (again nothing special if the dependency has env flag) 3. Low level information like line numbers (tracer provides this) 4. Log levels (bunyan/winston provide this but debug doesn't) 5. Namespace based toggling for logs (bunyan/winston miss this while debug provides it) 6. Human readable json print out to console AND files. Winston doesn't prettyPrint to log files and even what it does print is such a far cry from how it would look compared to console.log that without custom formatting I can't see how to use it. For example logging an array looks quite different, it almost made me think I had the wrong data structure the first time around.

I feel like there is some room for improvement. I would love to see debug and tracer mashed together somehow ... found debug-trace interestingly enough ... with the added capability to log to files and have log levels.

https://blog.risingstack.com/node-js-logging-tutorial/
https://www.loggly.com/blog/three-node-js-libraries-which-make-sophisticated-logging-simpler/
LogTown
Pulkit Singhal