Simple Logger for Loggly
WordPress integration of a Simple PHP Logging API for Loggly
by Scott Kingsley Clark · github.com/sc0ttkclark/simple-logger-for-loggly · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/sc0ttkclark/simple-logger-for-loggly/archive/refs/heads/main.zipReadme
Simple Logger for Loggly
This is a small plugin that integrates Loggly logging with WordPress.
Configuration
The configuration is currently all done via PHP constants that you can define in your wp-config.php file.
Required
Token
You MUST set a token to use the API. All other configuration is optional.
See https://{username}.loggly.com/tokens/ to get your token.
define( 'SIMPLE_LOGGER_FOR_LOGGLY_TOKEN', 'abcdef' );
Optional
PHP error handling
You can enable automatic integration with PHP error logs.
The default is off.
define( 'SIMPLE_LOGGER_FOR_LOGGLY_ERROR_HANDLER', true );
Customize PHP error log level
You can customize the error log level to log to Loggly. It uses the same values as error_reporting().
_The default level is to log all errors (E_ALL)._
// Log only deprecation messages.
define( 'SIMPLE_LOGGER_FOR_LOGGLY_ERROR_LOG_LEVEL', E_DEPRECATED );
Customize log destination
You can customize the destination if needed or if you want to customize how it gets tagged. It must contain a "%s" for the token to be set in it dynamically.
The default is https://logs-01.loggly.com/inputs/%s/tag/http/
define( 'SIMPLE_LOGGER_FOR_LOGGLY_DESTINATION', 'https://logs-01.loggly.com/inputs/%s/tag/mytag/ ' );