TFG Logger
Wrapper for the Google Cloud logging winston package. Perfect for use in express applications for logging.
Quickstart
- Wrap app.js in an async
- Create server in server.js
- Create logger with settings in app.js
- Wrap logger in middleware object
- Mount the middleware object, you now have the two logging objects for use throughout your application
// app.js { const TfgLogging = ; // Create the winston logger for use throughout the application, // Logs to console in a correctly formatted way const tfg_logger = TfgLogging; // Make middleware for use in routing, var mw_logger = await TfgLogging; return app; } // server.js #!/usr/bin/nodejsvar debug = 'my-application'; { var app = await ; app; var server = app;} ;
Features
- Includes all logging levels 1 - 7
- Includes the service name in the console log - great to filter between multiple services in a single log file
- Prints the stacktrace to the console (bugfix!)
- Sends the logs to GCP
- Nicely formats requests in Stackdriver, includes all logs within a request and the response code
Coming Soon
- Create error reports