joystick icon indicating copy to clipboard operation
joystick copied to clipboard

Add a joystick.log_in_development() function

Open rglover opened this issue 2 years ago • 3 comments

This would be really handy. Logs are essential for development, but we don't want them in non-development environments. It'd be helpful to have a function that automates this like so:

import joystick from '@joystick.js/node';

joystick.log_in_development('something to log');

This would just be a wrapper with an env check around the native console.log().

rglover avatar Sep 18 '23 20:09 rglover

Could also add joystick.log_in_staging() and joystick.log_in_production() as those things can happen for information beyond debugging.

rglover avatar Sep 18 '23 20:09 rglover

All of the above may be good candidates for addition to #49.

rglover avatar Sep 18 '23 20:09 rglover

Would be best to do this as joystick[log|warn|error|info]('something', ['development']) where the second argument is an array of environments to log the message in. If no environments are passed, it's assumed to be dev only.

rglover avatar Jul 23 '24 20:07 rglover