Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Files excluded from the release zip (wp dist-archive / rsync --exclude-from syntax).
/.git
/.github
/.gitignore
/.gitattributes
/.distignore
/.editorconfig
/.DS_Store
/node_modules
/tests
/bin
/phpcs.xml
/phpcs.xml.dist
/phpunit.xml.dist
/composer.json
/composer.lock
/package.json
/package-lock.json
/README.md
/CLAUDE.md
*.zip
*.log
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: CI
on: { pull_request: {}, push: { branches: [main] } }
jobs:
ci:
uses: prolific-digital/.github/.github/workflows/wp-plugin-ci.yml@main
with: { slug: betterstack-logger }
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Release
on: { push: { tags: ['v*'] } }
permissions: { contents: write }
jobs:
release:
uses: prolific-digital/.github/.github/workflows/wp-plugin-release.yml@main
with: { slug: betterstack-logger }
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
vendor/
*.zip
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Changelog

All notable changes to this project are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.1.0] - 2026-09-29

### Changed
- Adopted the Prolific plugin standard. Updates now come from the Prolific Digital license server (`api.prolificdigital.io`). Set `PROLIFIC_LICENSE_KEY_BETTERSTACK_LOGGER` in `wp-config.php` (or use the `prolific_license_key` filter) to receive updates.
- License is GPL-2.0-or-later (the bundled LICENSE file was GPL-3.0 text).
- Requires WordPress 6.5+ and PHP 8.4+.

### Added
- `BETTERSTACK_LOGGER_VERSION` constant and translation loading from `languages/`.
- `uninstall.php` removes the plugin's three options.
- `CHANGELOG.md`, coding-standards config and CI/release workflows.

### Security
- Requests to BetterStack now verify the TLS certificate. `wp_remote_post()` was called with `sslverify => false`, which let anyone on the network path intercept log messages and the source token. It now uses the WordPress default (verify).
- The source token is sanitized on save (only Bearer-token characters are kept) and the two logging checkboxes are stored only as `yes` or empty. The token was already escaped on the settings screen.

## [1.0.0] - 2024-08-10

### Added
- Initial release: error, user, post, plugin and theme event logging to BetterStack, `better_error_log()` and `b_log()` helpers, and a **Tools > BetterStack Logger** settings page with a test message form.

[Unreleased]: https://github.com/prolific-digital/betterstack-logger/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/prolific-digital/betterstack-logger/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/prolific-digital/betterstack-logger/releases/tag/v1.0.0
898 changes: 281 additions & 617 deletions LICENSE

Large diffs are not rendered by default.

55 changes: 45 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

BetterStack Logger is a powerful WordPress plugin that allows you to seamlessly integrate BetterStack with your WordPress site. Enhance your logging capabilities by sending error messages, post changes, user actions, and more directly to BetterStack. With easy configuration and flexible logging functions, this plugin is an essential tool for developers and site administrators looking to keep track of their site's activities.

| | |
|---|---|
| Requires | WordPress 6.5+, PHP 8.4+ |
| Text domain | `betterstack-logger` |
| License | GPL-2.0-or-later |

## Features

- **Error Logging:** Capture and log WordPress errors directly to BetterStack.
Expand All @@ -14,16 +20,6 @@ BetterStack Logger is a powerful WordPress plugin that allows you to seamlessly

## Installation

### From Your WordPress Dashboard

1. Navigate to `Plugins` -> `Add New`.
2. Search for `BetterStack Logger`.
3. Click `Install Now`.
4. Activate the plugin.
5. Go to `Tools` -> `BetterStack Logger Settings` to configure the plugin.

### Manual Installation

1. Download the plugin from the [Plugin Releases](https://github.com/prolific-digital/betterstack-logger/releases).
2. Upload the `betterstack-logger` directory to the `/wp-content/plugins/` directory.
3. Activate the plugin through the `Plugins` menu in WordPress.
Expand Down Expand Up @@ -91,6 +87,45 @@ What types of events can I log with BetterStack Logger?

You can log errors, user actions (e.g., logins, registrations), post changes (e.g., creation, updates, deletions), plugin activations/deactivations, theme switches, and custom messages.

## Updates

Updates are served by the Prolific Digital license server. Add the site's license key to `wp-config.php`:

```php
define( 'PROLIFIC_LICENSE_KEY_BETTERSTACK_LOGGER', 'your-key' );
```

You can also supply the key with the `prolific_license_key` filter, which receives `( $key, 'betterstack-logger' )`.

## Development

The dev site is the DDEV sandbox at `https://wp-sandbox.ddev.site`. Run commands in the container:

```sh
ddev exec -d /var/www/html/wp-content/plugins/betterstack-logger composer install
ddev exec -d /var/www/html/wp-content/plugins/betterstack-logger composer lint # php -l on every file
ddev exec -d /var/www/html/wp-content/plugins/betterstack-logger composer phpcs # WordPress-Extra + PHPCompatibilityWP
```

`vendor/` is not committed. A git checkout needs `composer install` before the updater loads. The plugin itself still runs without it.

## Releasing

1. Bump the version in the plugin header, `BETTERSTACK_LOGGER_VERSION` and `readme.txt` `Stable tag`.
2. Add a `## [x.y.z] - YYYY-MM-DD` section to `CHANGELOG.md` and a `= x.y.z =` entry to `readme.txt`.
3. Merge to `main`, then push a `vx.y.z` tag. The release workflow builds `betterstack-logger.zip` (with `composer install --no-dev`, honoring `.distignore`) and attaches it to a GitHub Release.

CI and release logic live in the shared workflows in [`prolific-digital/.github`](https://github.com/prolific-digital/.github).
## Stored data

| Key | Type | Purpose |
|---|---|---|
| `betterstack_api_key` | option | BetterStack source token (unless `BETTERSTACK_API_KEY` is defined) |
| `betterstack_error_logging_enabled` | option | `yes` to log `wp_die()` errors |
| `betterstack_event_logging_enabled` | option | `yes` to log user, post, plugin and theme events |

Uninstalling deletes all three options.

## Support

If you need help or have any questions, feel free to reach out to us:
Expand Down
57 changes: 39 additions & 18 deletions betterstack-logger.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
<?php
/*
Plugin Name: BetterStack Logger
Plugin URI: https://prolificdigital.com
Description: Seamlessly integrate with BetterStack to log messages directly from your WordPress site. Enhance your logging capabilities with ease and precision.
Short Description: Seamlessly integrate with BetterStack to log messages directly from your WordPress site.
Tags: betterstack, logger, logging, error, errors, debug, debugging, log, logs, monitoring, monitoring, betterstack logger, betterstack logging, betterstack error logging, betterstack error logger, betterstack debug logging, betterstack debug logger
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 8.0
Tested up to: 6.6
Author: Prolific Digital
Author URI: https://prolificdigital.com
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: betterstack-logger
/**
* Plugin Name: BetterStack Logger
* Plugin URI: https://prolificdigital.com
* Description: Sends error messages, user actions, post changes and custom log messages from WordPress to BetterStack.
* Version: 1.1.0
* Requires at least: 6.5
* Requires PHP: 8.4
* Author: Prolific Digital
* Author URI: https://prolificdigital.com
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: betterstack-logger
* Domain Path: /languages
* Update URI: https://api.prolificdigital.io/api/update?plugin=betterstack-logger
*
* @package BetterStackLogger
*/

defined( 'ABSPATH' ) || exit;

define( 'BETTERSTACK_LOGGER_VERSION', '1.1.0' );

*/
define( 'BETTERSTACK_LOGGER_PLUGIN_FILE', __FILE__ );
define( 'BETTERSTACK_LOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );

if (!defined('WPINC')) {
die;
// Composer dependencies (plugin-update-checker). Present in release zips;
// in a git checkout run `composer install` first.
if ( is_readable( BETTERSTACK_LOGGER_PLUGIN_DIR . 'vendor/autoload.php' ) ) {
require_once BETTERSTACK_LOGGER_PLUGIN_DIR . 'vendor/autoload.php';
}

require_once BETTERSTACK_LOGGER_PLUGIN_DIR . 'includes/update-checker.php';

/**
* Load bundled translations from /languages (the header's Domain Path).
*/
add_action(
'init',
static function () {
load_plugin_textdomain( 'betterstack-logger', false, dirname( plugin_basename( BETTERSTACK_LOGGER_PLUGIN_FILE ) ) . '/languages' );
}
);

require_once plugin_dir_path(__FILE__) . 'includes/BetterStackLogger.php';

// Create a global instance of the BetterStackLogger class
Expand Down
38 changes: 38 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "prolific-digital/betterstack-logger",
"description": "Sends error messages, user actions, post changes and custom log messages from WordPress to BetterStack.",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Prolific Digital",
"homepage": "https://prolificdigital.com"
}
],
"require": {
"php": ">=8.4",
"yahnis-elsts/plugin-update-checker": "^5.7"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpcompatibility/phpcompatibility-wp": "^3.0@alpha",
"squizlabs/php_codesniffer": "^3.10",
"wp-coding-standards/wpcs": "^3.1"
},
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"platform": {
"php": "8.4"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"lint": "find . -path ./vendor -prune -o -path ./node_modules -prune -o -name '*.php' -print0 | xargs -0 -n1 php -l",
"phpcs": "phpcs"
},
"minimum-stability": "alpha",
"prefer-stable": true
}
Loading
Loading