custom logger that can be used in Linux and Mac systems
To get started, copy logger.sh to any directory and run as executable.
-m 'log message' pass string log messages. Compulsory
-o 'file with path' write to output file. Defaults to /var/logs/tracelog.current date
-d turn off timestamp logging. Defaults to true
At minimum, you'd want to try something like:
./logger.sh -m "expo-webview - Received request for profile update"
Log message can be custom styled. I like to stick to a format of application_name and event message separated by a hyphen. This is a simpler version of RFC standardized format implemented by syslog.
A fuller usage below:
./logger.sh -d -m "expo-webview - Received request for profile update" -o /var/etc/logs/expo.logs
Add support for piping and redirects for easier integration.
Add logrotate to auto rotate logs on given interval basis with support for setting file size limits, compression, etc