.
* @since 1.0.0
*/
namespace Decalog\Plugin\Feature;
use Monolog\Logger;
use Decalog\System\Cache;
/**
* Define the logger types functionality.
*
* Handles all available logger types.
*
* @package Features
* @author Pierre Lannoy .
* @since 1.0.0
*/
class HandlerTypes {
/**
* The array of available types.
*
* @since 1.0.0
* @var array $handlers The available types.
*/
private $handlers = [];
/**
* The array of available class names.
*
* @since 3.0.0
* @var array $handlers_class The available class names.
*/
private $handlers_class = [];
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
*/
public function __construct() {
$this->handlers_class = [
'alerting' => esc_html__( 'Crash Analytics', 'decalog' ),
'analytics' => esc_html__( 'Alerting', 'decalog' ),
'debugging' => esc_html__( 'Debugging', 'decalog' ),
'logging' => esc_html__( 'Logging', 'decalog' ),
'metrics' => esc_html__( 'Monitoring', 'decalog' ),
'tracing' => esc_html__( 'Tracing', 'decalog' ),
];
// TRACING
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'DatadogTracingHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'tracing',
'minimal' => Logger::EMERGENCY,
'name' => 'Datadog Traces',
'help' => esc_html__( 'Traces sent to Datadog via Datadog local agent.', 'decalog' ),
'icon' => $this->get_base64_datadog_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [],
'configuration' => [
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'format' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Format', 'decalog' ),
'help' => esc_html__( 'The format in which to push data.', 'decalog' ),
'default' => 300,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => false,
'list' => [ [ 300, 'DD/0.3' ] ],
],
],
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send spans. Format: %s.', 'decalog' ), '' . htmlentities( '://[:]' ) . '' ),
'default' => 'http://localhost:8126',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'format',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'configuration',
'value' => 'url',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'JaegerTracingHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'tracing',
'minimal' => Logger::EMERGENCY,
'name' => 'Jaeger',
'help' => esc_html__( 'Traces sent to a Jaeger collector.', 'decalog' ),
'icon' => $this->get_base64_jaeger_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [],
'configuration' => [
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'format' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Format', 'decalog' ),
'help' => esc_html__( 'The format in which to push data.', 'decalog' ),
'default' => 200,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 100, 'Zipkin V2' ], [ 200, 'Jaeger thrift over HTTP' ] ],
],
],
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send spans. Format: %s.', 'decalog' ), '' . htmlentities( '://[:]' ) . '' ),
'default' => 'http://localhost:14268',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'format',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'configuration',
'value' => 'url',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'TempoTracingHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'tracing',
'minimal' => Logger::EMERGENCY,
'name' => 'Tempo',
'help' => esc_html__( 'Traces sent to a Tempo instance.', 'decalog' ),
'icon' => $this->get_base64_tempo_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [],
'configuration' => [
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'format' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Format', 'decalog' ),
'help' => esc_html__( 'The format in which to push data.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 100, 'Zipkin V2' ], [ 200, 'Jaeger thrift over HTTP' ] ],
],
],
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send spans. Format: %s.', 'decalog' ), '' . htmlentities( '://[:]' ) . '' ),
'default' => 'http://localhost:9411',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'format',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'configuration',
'value' => 'url',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'GrafanaTracingHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'tracing',
'minimal' => Logger::EMERGENCY,
'name' => 'Grafana Cloud Traces',
'help' => esc_html__( 'Traces sent to Grafana Cloud via Grafana agent.', 'decalog' ),
'icon' => $this->get_base64_grafana_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'format' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Format', 'decalog' ),
'help' => esc_html__( 'The format in which to push data.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 100, 'Zipkin V2' ], [ 200, 'Jaeger thrift over HTTP' ] ],
],
],
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send spans. Format: %s.', 'decalog' ), '' . htmlentities( '://[:]' ) . '' ),
'default' => 'http://localhost:9411',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'url',
],
[
'type' => 'configuration',
'value' => 'format',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'ZipkinTracingHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'tracing',
'minimal' => Logger::EMERGENCY,
'name' => 'Zipkin',
'help' => esc_html__( 'Traces sent to a Zipkin instance.', 'decalog' ),
'icon' => $this->get_base64_zipkin_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [],
'configuration' => [
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'format' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Format', 'decalog' ),
'help' => esc_html__( 'The format in which to push data.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => false,
'list' => [ [ 100, 'Zipkin V2' ] ],
],
],
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send spans. Format: %s.', 'decalog' ), '' . htmlentities( '://[:]' ) . '' ),
'default' => 'http://localhost:9411',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'configuration',
'value' => 'url',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'WordpressTracingHandler',
'namespace' => 'Decalog\Handler',
'class' => 'tracing',
'minimal' => Logger::EMERGENCY,
'name' => esc_html__( 'WordPress traces', 'decalog' ),
'help' => esc_html__( 'Traces stored in WordPress and available right in your admin dashboard.', 'decalog' ),
'icon' => $this->get_base64_wordpress_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [
'included' => [ 'WordpressProcessor', 'WWWProcessor', 'IntrospectionProcessor' ],
],
'configuration' => [
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'constant-storage' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Storage', 'decalog' ),
'help' => esc_html__( 'Place where to store traces.', 'decalog' ) . '
' . esc_html__( 'Note: it\'s not possible to change storage type after logger creation.', 'decalog' ),
'default' => 'db',
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => Cache::$apcu_available,
'list' => [ [ 'db', esc_html__( 'Database: persistent after a server restart', 'decalog' ) ], [ 'apcu', esc_html__( 'APCu: high performance but reset after each server reboot', 'decalog' ), Cache::$apcu_available ] ],
],
],
'rotate' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Traces', 'decalog' ),
'help' => esc_html__( 'Maximum number of traces stored in this traces log (0 for no limit).', 'decalog' ),
'default' => 10000,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 0,
'max' => 10000000,
'step' => 1000,
'enabled' => true,
],
],
'purge' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Days', 'decalog' ),
'help' => esc_html__( 'Maximum age of traces stored in this traces log (0 for no limit).', 'decalog' ),
'default' => 5,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 0,
'max' => 730,
'step' => 1,
'enabled' => true,
],
],
'local' => [
'type' => 'boolean',
'show' => is_multisite(),
'name' => esc_html__( 'Multisite partitioning', 'decalog' ),
'help' => esc_html__( 'Local administrators can view traces that relate to their site.', 'decalog' ),
'default' => false,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'compute',
'value' => 'tablename',
],
[
'type' => 'configuration',
'value' => 'constant-storage',
],
],
];
// MONITORING
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'DatadogMonitoringHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'metrics',
'minimal' => Logger::EMERGENCY,
'name' => 'Datadog Metrics',
'help' => esc_html__( 'Metrics sent to Datadog.', 'decalog' ),
'icon' => $this->get_base64_datadog_icon(),
'needs' => [],
'params' => [],
'processors' => [],
'configuration' => [
'profile' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Profile', 'decalog' ),
'help' => sprintf( __( 'The type of metrics to collect (%s). Choosing "Automatic" sets the profile to the current WordPress environment type.', 'decalog' ), sprintf( '%s', esc_html__( 'details', 'decalog' ) ) ),
'default' => 500,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 500, esc_html__( 'Automatic', 'decalog' ) ], [ 600, esc_html__( 'Production', 'decalog' ) ], [ 550, esc_html__( 'Development', 'decalog' ) ] ],
],
],
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Location', 'decalog' ),
'help' => esc_html__( 'The Datadog cloud location.', 'decalog' ),
'default' => 'https://http-intake.logs.datadoghq.com/v1/input',
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 'https://api.datadoghq.eu/api/v1/series', esc_html__( 'Europe', 'decalog' ) ], [ 'https://api.datadoghq.com/api/v1/series', esc_html__( 'United States', 'decalog' ) ] ],
],
],
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'API key', 'decalog' ),
'help' => esc_html__( 'The API key of the service.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'configuration',
'value' => 'profile',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'InfluxMonitoringHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'metrics',
'minimal' => Logger::EMERGENCY,
'name' => 'InfluxDB 2',
'help' => esc_html__( 'Metrics sent to InfluxDB Cloud or on-premise InfluxDB 2 instance or cluster.', 'decalog' ),
'icon' => $this->get_base64_infuxdb_icon(),
'needs' => [],
'params' => [],
'processors' => [],
'configuration' => [
'profile' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Profile', 'decalog' ),
'help' => sprintf( __( 'The type of metrics to collect (%s). Choosing "Automatic" sets the profile to the current WordPress environment type.', 'decalog' ), sprintf( '%s', esc_html__( 'details', 'decalog' ) ) ),
'default' => 500,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 500, esc_html__( 'Automatic', 'decalog' ) ], [ 600, esc_html__( 'Production', 'decalog' ) ], [ 550, esc_html__( 'Development', 'decalog' ) ] ],
],
],
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send metrics. Format: %s.', 'decalog' ), '' . htmlentities( '://[:]' ) . '' ),
'default' => 'http://localhost:8086',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'org' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Organization', 'decalog' ),
'help' => esc_html__( 'Organization name to use (must exist).', 'decalog' ),
'default' => 'my-org',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'bucket' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Bucket', 'decalog' ),
'help' => esc_html__( 'Bucket name to use (must exist).', 'decalog' ),
'default' => 'my-bucket',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Token', 'decalog' ),
'help' => esc_html__( 'Token value to write in bucket.', 'decalog' ),
'default' => 'my-bucket',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'profile',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'configuration',
'value' => 'url',
],
[
'type' => 'configuration',
'value' => 'org',
],
[
'type' => 'configuration',
'value' => 'bucket',
],
[
'type' => 'configuration',
'value' => 'token',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'PrometheusMetricsEPHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'metrics',
'minimal' => Logger::EMERGENCY,
'name' => 'Prometheus Endpoint',
'help' => esc_html__( 'Metrics published on this site as polling endpoint.', 'decalog' ),
'icon' => $this->get_base64_prometheus_icon(),
'needs' => [],
'params' => [],
'processors' => [],
'configuration' => [
'profile' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Profile', 'decalog' ),
'help' => sprintf( __( 'The type of metrics to collect (%s). Choosing "Automatic" sets the profile to the current WordPress environment type.', 'decalog' ), sprintf( '%s', esc_html__( 'details', 'decalog' ) ) ),
'default' => 500,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 500, esc_html__( 'Automatic', 'decalog' ) ], [ 600, esc_html__( 'Production', 'decalog' ) ], [ 550, esc_html__( 'Development', 'decalog' ) ] ],
],
],
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'profile',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'PrometheusMonitoringHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'metrics',
'minimal' => Logger::EMERGENCY,
'name' => 'Prometheus Pushgateway',
'help' => esc_html__( 'Metrics sent to a Prometheus Pushgateway instance.', 'decalog' ),
'icon' => $this->get_base64_prometheus_icon(),
'needs' => [],
'params' => [],
'processors' => [],
'configuration' => [
'profile' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Profile', 'decalog' ),
'help' => sprintf( __( 'The type of metrics to collect (%s). Choosing "Automatic" sets the profile to the current WordPress environment type.', 'decalog' ), sprintf( '%s', esc_html__( 'details', 'decalog' ) ) ),
'default' => 500,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 500, esc_html__( 'Automatic', 'decalog' ) ], [ 600, esc_html__( 'Production', 'decalog' ) ], [ 550, esc_html__( 'Development', 'decalog' ) ] ],
],
],
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send metrics. Format: %s.', 'decalog' ), '' . htmlentities( '://[:]' ) . '' ),
'default' => 'http://localhost:9091',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'model' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Labels', 'decalog' ),
'help' => esc_html__( 'Template for labels. If you are unsure of the implications on cardinality, choose the first one.', 'decalog' ),
'default' => 0,
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 0, '{job="x", instance="y"} - ' . esc_html__( 'Recommended in most cases', 'decalog' ) ], [ 1, '{job="x", instance="y", env="z"} - ' . esc_html__( 'Classical environment segmentation', 'decalog' ) ], [ 2, '{job="x", instance="y", version="z"} - ' . esc_html__( 'Classical version segmentation', 'decalog' ) ], [ 3, '{job="x", site="y"} - ' . esc_html__( 'WordPress Multisite segmentation', 'decalog' ) ] ],
],
],
'id' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Job', 'decalog' ),
'help' => esc_html__( 'The fixed job name for some templates.', 'decalog' ),
'default' => 'wp_decalog',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'profile',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'configuration',
'value' => 'url',
],
[
'type' => 'configuration',
'value' => 'model',
],
[
'type' => 'configuration',
'value' => 'id',
],
],
];
/*$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'GrafanaMonitoringHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'metrics',
'minimal' => Logger::EMERGENCY,
'name' => 'Grafana Cloud Metrics',
'help' => esc_html__( 'Metrics sent to Grafana Cloud via Grafana agent.', 'decalog' ),
'icon' => $this->get_base64_grafana_icon(),
'needs' => [],
'params' => [],
'processors' => [],
'configuration' => [
'profile' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Profile', 'decalog' ),
'help' => sprintf( __( 'The type of metrics to collect (%s). Choosing "Automatic" sets the profile to the current WordPress environment type.', 'decalog' ), sprintf( '%s', esc_html__( 'details', 'decalog' ) ) ),
'default' => 500,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 500, esc_html__( 'Automatic', 'decalog' ) ], [ 600, esc_html__( 'Production', 'decalog' ) ], [ 550, esc_html__( 'Development', 'decalog' ) ] ],
],
],
'sampling' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Sampling', 'decalog' ),
'help' => esc_html__( 'Sampling rate to be chosen according to the site traffic.', 'decalog' ),
'default' => 100,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 1000, '100%' ], [ 500, '50%' ], [ 250, '25%' ], [ 100, '10%' ], [ 50, '5%' ], [ 20, '2%' ], [ 10, '1%' ], [ 5, '5‰' ], [ 2, '2‰' ], [ 1, '1‰' ] ],
],
],
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Prometheus host', 'decalog' ),
'help' => sprintf( esc_html__( 'The host name portion of the Prometheus instance url. Something like %s.', 'decalog' ), 'prometheus-us-central1' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'user' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Username', 'decalog' ),
'help' => sprintf( esc_html__( 'The user name for Basic Auth authentication. Something like %s.', 'decalog' ), '21087' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'key' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'API key', 'decalog' ),
'help' => esc_html__( 'The Grafana.com API Key.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'model' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Labels', 'decalog' ),
'help' => esc_html__( 'Template for labels. If you are unsure of the implications on cardinality, choose the first one.', 'decalog' ),
'default' => 0,
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 0, '{job="x", instance="y"} - ' . esc_html__( 'Recommended in most cases', 'decalog' ) ], [ 1, '{job="x", instance="y", env="z"} - ' . esc_html__( 'Classical environment segmentation', 'decalog' ) ], [ 2, '{job="x", instance="y", version="z"} - ' . esc_html__( 'Classical version segmentation', 'decalog' ) ], [ 3, '{job="x", site="y"} - ' . esc_html__( 'WordPress Multisite segmentation', 'decalog' ) ] ],
],
],
'id' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Job', 'decalog' ),
'help' => esc_html__( 'The fixed job name for some templates.', 'decalog' ),
'default' => 'wp_decalog',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'uuid',
],
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'user',
],
[
'type' => 'configuration',
'value' => 'key',
],
[
'type' => 'configuration',
'value' => 'profile',
],
[
'type' => 'configuration',
'value' => 'sampling',
],
[
'type' => 'configuration',
'value' => 'model',
],
[
'type' => 'configuration',
'value' => 'id',
],
],
];*/
// LOGGING
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'DatadogHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::INFO,
'name' => 'Datadog Events',
'help' => esc_html__( 'Events sent to Datadog.', 'decalog' ),
'icon' => $this->get_base64_datadog_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Location', 'decalog' ),
'help' => esc_html__( 'The Datadog cloud location.', 'decalog' ),
'default' => 'https://http-intake.logs.datadoghq.com/v1/input',
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 'https://http-intake.logs.datadoghq.eu/v1/input', esc_html__( 'Europe', 'decalog' ) ], [ 'https://http-intake.logs.datadoghq.com/v1/input', esc_html__( 'United States', 'decalog' ) ] ],
],
],
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'API key', 'decalog' ),
'help' => esc_html__( 'The API key of the service.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'buffer' => [
'type' => 'boolean',
'show' => true,
'name' => esc_html__( 'Deferred forwarding', 'decalog' ),
'help' => esc_html__( 'Wait for the full page is rendered before sending reports (recommended).', 'decalog' ),
'default' => true,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'literal',
'value' => true,
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'NullHandler',
'namespace' => 'Monolog\Handler',
'class' => 'system',
'minimal' => Logger::DEBUG,
'name' => esc_html__( 'Blackhole', 'decalog' ),
'help' => esc_html__( 'Any event it can handle will be thrown away.', 'decalog' ),
'icon' => $this->get_base64_php_icon(),
'needs' => [],
'params' => [],
'configuration' => [],
'init' => [],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'SharedMemoryHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'system',
'minimal' => Logger::INFO,
'name' => esc_html__( 'Shared memory', 'decalog' ),
'help' => esc_html__( 'Automatic events log, stored in server shared memory.', 'decalog' ),
'icon' => $this->get_base64_ram_icon(),
'needs' => [
'option' => [ 'livelog' ],
'function_exists' => [ 'shmop_open', 'shmop_read', 'shmop_write', 'shmop_delete', 'shmop_close' ],
],
'params' => [],
'configuration' => [],
'init' => [],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'BugsnagHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'analytics',
'minimal' => Logger::WARNING,
'name' => 'Bugsnag',
'help' => esc_html__( 'Crash reports sent to Bugsnag service.', 'decalog' ),
'icon' => $this->get_base64_bugsnag_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [
'included' => [ 'WordpressProcessor', 'WWWProcessor', 'IntrospectionProcessor' ],
'excluded' => [ 'BacktraceProcessor' ],
],
'configuration' => [
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'API key', 'decalog' ),
'help' => esc_html__( 'The API key of the service.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'buffer' => [
'type' => 'boolean',
'show' => true,
'name' => esc_html__( 'Deferred forwarding', 'decalog' ),
'help' => esc_html__( 'Wait for the full page is rendered before sending reports (recommended).', 'decalog' ),
'default' => true,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'literal',
'value' => true,
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_MONOLOG_VERSION,
'id' => 'BrowserConsoleHandler',
'namespace' => 'Monolog\\Handler',
'class' => 'debugging',
'minimal' => Logger::DEBUG,
'name' => esc_html__( 'Browser console', 'decalog' ),
'help' => esc_html__( 'Events sent to browser\'s javascript console with no browser extension required.', 'decalog' ),
'icon' => $this->get_base64_browserconsole_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [],
'init' => [
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_MONOLOG_VERSION,
'id' => 'ChromePHPHandler',
'namespace' => 'Monolog\\Handler',
'class' => 'debugging',
'minimal' => Logger::DEBUG,
'name' => 'ChromePHP',
'help' => esc_html__( 'Events sent to the ChromePHP extension (http://www.chromephp.com/).', 'decalog' ),
'icon' => $this->get_base64_chrome_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [],
'init' => [
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'ElasticCloudHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Elastic Cloud - Events',
'help' => esc_html__( 'Events sent to Elastic Cloud.', 'decalog' ),
'icon' => $this->get_base64_elasticcloud_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'cloudid' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Cloud ID', 'decalog' ),
'help' => esc_html__( 'The generated cloud ID.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'user' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Username', 'decalog' ),
'help' => esc_html__( 'The username of the instance.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'pass' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Password', 'decalog' ),
'help' => esc_html__( 'The password of the instance.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'index' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Index', 'decalog' ),
'help' => esc_html__( 'The index name.', 'decalog' ),
'default' => '_index',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'cloudid',
],
[
'type' => 'configuration',
'value' => 'user',
],
[
'type' => 'configuration',
'value' => 'pass',
],
[
'type' => 'configuration',
'value' => 'index',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'ElasticHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Elasticsearch - Events',
'help' => esc_html__( 'Events sent to Elasticsearch.', 'decalog' ),
'icon' => $this->get_base64_elasticsearch_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send logs. Format: %s.', 'decalog' ), '' . htmlentities( '://:' ) . '' ),
'default' => 'http://localhost:9200',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'user' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Username', 'decalog' ),
'help' => esc_html__( 'The username of the instance.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'pass' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Password', 'decalog' ),
'help' => esc_html__( 'The password of the instance.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'index' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Index', 'decalog' ),
'help' => esc_html__( 'The index name.', 'decalog' ),
'default' => '_index',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'url',
],
[
'type' => 'configuration',
'value' => 'user',
],
[
'type' => 'configuration',
'value' => 'pass',
],
[
'type' => 'configuration',
'value' => 'index',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'FluentHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Fluentd',
'help' => esc_html__( 'Events sent to a Fluentd collector.', 'decalog' ),
'icon' => $this->get_base64_fluentd_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Connection string', 'decalog' ),
'help' => esc_html__( 'Connection string to Fluentd. Can be something like "tcp://127.0.0.1:24224" or something like "unix:///var/run/td-agent/td-agent.sock".', 'decalog' ),
'default' => 'tcp://localhost:24224',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'timeout' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Socket timeout', 'decalog' ),
'help' => esc_html__( 'Max number of milliseconds to wait for the socket.', 'decalog' ),
'default' => 800,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 100,
'max' => 10000,
'step' => 100,
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'timeout',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'GrafanaHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::INFO,
'name' => 'Grafana Cloud Events',
'help' => esc_html__( 'Events sent to Grafana Cloud.', 'decalog' ),
'icon' => $this->get_base64_grafana_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Loki host', 'decalog' ),
'help' => sprintf( esc_html__( 'The host name portion of the Loki instance url. Something like %s.', 'decalog' ), 'logs-prod-us-central1' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'user' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Username', 'decalog' ),
'help' => sprintf( esc_html__( 'The user name for Basic Auth authentication. Something like %s.', 'decalog' ), '21087' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'key' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'API key', 'decalog' ),
'help' => esc_html__( 'The Grafana.com API Key.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'model' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Labels', 'decalog' ),
'help' => esc_html__( 'Template for labels. If you are unsure of the implications on cardinality, choose the first one.', 'decalog' ),
'default' => 0,
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 0, '{job="x", instance="y"} - ' . esc_html__( 'Recommended in most cases', 'decalog' ) ], [ 1, '{job="x", instance="y", level="z"} - ' . esc_html__( 'Classical level segmentation', 'decalog' ) ], [ 2, '{job="x", instance="y", env="z"} - ' . esc_html__( 'Classical environment segmentation', 'decalog' ) ], [ 3, '{job="x", instance="y", version="z"} - ' . esc_html__( 'Classical version segmentation', 'decalog' ) ], [ 4, '{job="x", level="y", env="z"} - ' . esc_html__( 'Double level / environment segmentation', 'decalog' ) ], [ 5, '{job="x", site="y"} - ' . esc_html__( 'WordPress Multisite segmentation', 'decalog' ) ] ],
],
],
'id' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Job', 'decalog' ),
'help' => esc_html__( 'The fixed job name for some templates.', 'decalog' ),
'default' => 'wp_decalog',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'user',
],
[
'type' => 'configuration',
'value' => 'key',
],
[
'type' => 'configuration',
'value' => 'model',
],
[
'type' => 'configuration',
'value' => 'id',
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'GAnalyticsHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'analytics',
'minimal' => Logger::WARNING,
'name' => 'Google Universal Analytics',
'help' => esc_html__( 'Exceptions sent to Google Universal Analytics service.', 'decalog' ),
'icon' => $this->get_base64_ganalytics_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [
'included' => [ 'WordpressProcessor', 'WWWProcessor' ],
'excluded' => [ 'BacktraceProcessor', 'IntrospectionProcessor' ],
],
'configuration' => [
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Tracking ID', 'decalog' ),
'help' => esc_html__( 'The tracking ID / web property ID for Google Universal Analytics service. The format must be UA-XXXX-Y.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'buffer' => [
'type' => 'boolean',
'show' => true,
'name' => esc_html__( 'Deferred forwarding', 'decalog' ),
'help' => esc_html__( 'Wait for the full page is rendered before sending exceptions (recommended).', 'decalog' ),
'default' => true,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'literal',
'value' => true,
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'LogentriesHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Logentries & insightOps',
'help' => esc_html__( 'Events sent to Logentries & insightOps service.', 'decalog' ),
'icon' => $this->get_base64_logentries_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Log endpoint region', 'decalog' ),
'help' => esc_html__( 'The region of remote host receiving messages.', 'decalog' ),
'default' => 'eu',
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 'eu', esc_html__( 'Europe', 'decalog' ) ], [ 'us', esc_html__( 'USA', 'decalog' ) ] ],
],
],
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Log token', 'decalog' ),
'help' => esc_html__( 'The token of the Logentries/insightOps log.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'timeout' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Socket timeout', 'decalog' ),
'help' => esc_html__( 'Max number of milliseconds to wait for the socket.', 'decalog' ),
'default' => 800,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 100,
'max' => 10000,
'step' => 100,
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'configuration',
'value' => 'timeout',
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_MONOLOG_VERSION,
'id' => 'LogglyHandler',
'namespace' => 'Monolog\\Handler',
'class' => 'logging',
'minimal' => Logger::WARNING,
'name' => 'Loggly',
'help' => esc_html__( 'Events sent to Solawinds Loggly service.', 'decalog' ),
'icon' => $this->get_base64_loggly_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Application token', 'decalog' ),
'help' => esc_html__( 'The token of the Solawinds Loggly application.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'token',
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'LokiHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::INFO,
'name' => 'Loki',
'help' => esc_html__( 'Events sent to a Loki instance.', 'decalog' ),
'icon' => $this->get_base64_loki_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'url' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Service URL', 'decalog' ),
'help' => sprintf( esc_html__( 'URL where to send logs. Format: %s.', 'decalog' ), '' . htmlentities( '://:' ) . '' ),
'default' => 'http://localhost:3100',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'model' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Labels', 'decalog' ),
'help' => esc_html__( 'Template for labels. If you are unsure of the implications on cardinality, choose the first one.', 'decalog' ),
'default' => 0,
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 0, '{job="x", instance="y"} - ' . esc_html__( 'Recommended in most cases', 'decalog' ) ], [ 1, '{job="x", instance="y", level="z"} - ' . esc_html__( 'Classical level segmentation', 'decalog' ) ], [ 2, '{job="x", instance="y", env="z"} - ' . esc_html__( 'Classical environment segmentation', 'decalog' ) ], [ 3, '{job="x", instance="y", version="z"} - ' . esc_html__( 'Classical version segmentation', 'decalog' ) ], [ 4, '{job="x", level="y", env="z"} - ' . esc_html__( 'Double level / environment segmentation', 'decalog' ) ], [ 5, '{job="x", site="y"} - ' . esc_html__( 'WordPress Multisite segmentation', 'decalog' ) ] ],
],
],
'id' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Job', 'decalog' ),
'help' => esc_html__( 'The fixed job name for some templates.', 'decalog' ),
'default' => 'wp_decalog',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'url',
],
[
'type' => 'configuration',
'value' => 'model',
],
[
'type' => 'configuration',
'value' => 'id',
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'MailHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'alerting',
'minimal' => Logger::WARNING,
'name' => esc_html__( 'Mail', 'decalog' ),
'help' => esc_html__( 'Event alerts sent by WordPress via mail.', 'decalog' ),
'icon' => $this->get_base64_mail_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'recipients' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Recipients', 'decalog' ),
'help' => esc_html__( 'The recipients mail address, in coma separated list.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'recipients',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_MONOLOG_VERSION,
'id' => 'ErrorLogHandler',
'namespace' => 'Monolog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => esc_html__( 'PHP error log', 'decalog' ),
'help' => esc_html__( 'Events stored in the standard PHP error log, as with the error_log() function, but more detailed.', 'decalog' ),
'icon' => $this->get_base64_php_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [],
'init' => [
[
'type' => 'literal',
'value' => 0,
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'PshHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'alerting',
'minimal' => Logger::WARNING,
'name' => 'Pushover',
'help' => esc_html__( 'Event alerts sent via Pushover service.', 'decalog' ),
'icon' => $this->get_base64_pushover_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Application token', 'decalog' ),
'help' => esc_html__( 'The token of the Pushover application.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'users' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Recipient', 'decalog' ),
'help' => esc_html__( 'The recipient key. It can be a "user key" or a "group key".', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'title' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Message title', 'decalog' ),
'help' => esc_html__( 'The title of the message which will be sent.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'timeout' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Socket timeout', 'decalog' ),
'help' => esc_html__( 'Max number of milliseconds to wait for the socket.', 'decalog' ),
'default' => 800,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 100,
'max' => 10000,
'step' => 100,
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'configuration',
'value' => 'users',
],
[
'type' => 'configuration',
'value' => 'title',
],
[
'type' => 'configuration',
'value' => 'timeout',
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'RaygunHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'analytics',
'minimal' => Logger::WARNING,
'name' => 'Raygun',
'help' => esc_html__( 'Crash reports sent to Raygun service.', 'decalog' ),
'icon' => $this->get_base64_raygun_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [
'included' => [ 'WordpressProcessor', 'WWWProcessor', 'IntrospectionProcessor' ],
'excluded' => [ 'BacktraceProcessor' ],
],
'configuration' => [
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'API key', 'decalog' ),
'help' => esc_html__( 'The API key of the service.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'buffer' => [
'type' => 'boolean',
'show' => true,
'name' => esc_html__( 'Deferred forwarding', 'decalog' ),
'help' => esc_html__( 'Wait for the full page is rendered before sending reports (recommended).', 'decalog' ),
'default' => true,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'literal',
'value' => true,
],
[ 'type' => 'level' ],
],
];
$this->handlers[] = [
'version' => DECALOG_MONOLOG_VERSION,
'id' => 'RotatingFileHandler',
'namespace' => 'Monolog\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => esc_html__( 'Rotating files', 'decalog' ),
'help' => esc_html__( 'Events sent to files that are rotated every day and a limited number of files are kept.', 'decalog' ),
'icon' => $this->get_base64_rotatingfiles_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'filename' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'File', 'decalog' ),
'help' => esc_html__( 'The full absolute path and filename, like "/path/to/file".', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'maxfiles' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Maximum', 'decalog' ),
'help' => esc_html__( 'The maximal number of files to keep (0 means unlimited).', 'decalog' ),
'default' => 60,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 0,
'max' => 730,
'step' => 1,
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'filename',
],
[
'type' => 'configuration',
'value' => 'maxfiles',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
[
'type' => 'literal',
'value' => 0666,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'SematextHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Sematext',
'help' => esc_html__( 'Events sent to Sematext using Elasticsearch APIs.', 'decalog' ),
'icon' => $this->get_base64_sematext_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Location', 'decalog' ),
'help' => esc_html__( 'The Sematext cloud location.', 'decalog' ),
'default' => 'logsene-receiver.sematext.com',
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 'logsene-receiver.sematext.com', esc_html__( 'North America', 'decalog' ) ], [ 'logsene-receiver.eu.sematext.com', esc_html__( 'Europe', 'decalog' ) ] ],
],
],
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Application Token', 'decalog' ),
'help' => esc_html__( 'The "Logs App Token" set in Sematext.', 'decalog' ),
'default' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'token',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
/*$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'SentryHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'analytics',
'minimal' => Logger::WARNING,
'name' => 'Sentry',
'help' => esc_html__( 'Crash reports sent to Sentry service.', 'decalog' ),
'icon' => $this->get_base64_sentry_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [
'included' => [ 'WordpressProcessor', 'WWWProcessor', 'IntrospectionProcessor' ],
'excluded' => [ 'BacktraceProcessor' ],
],
'configuration' => [
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'API key', 'decalog' ),
'help' => esc_html__( 'The API key of the service.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'buffer' => [
'type' => 'boolean',
'show' => true,
'name' => esc_html__( 'Deferred forwarding', 'decalog' ),
'help' => esc_html__( 'Wait for the full page is rendered before sending reports (recommended).', 'decalog' ),
'default' => true,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'literal',
'value' => true,
],
[ 'type' => 'level' ],
],
];*/
$this->handlers[] = [
'version' => DECALOG_MONOLOG_VERSION,
'id' => 'SlackWebhookHandler',
'namespace' => 'Monolog\Handler',
'class' => 'alerting',
'minimal' => Logger::WARNING,
'name' => 'Slack',
'help' => esc_html__( 'Event alerts sent through Slack Webhooks.', 'decalog' ),
'icon' => $this->get_base64_slack_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [
'excluded' => [ 'BacktraceProcessor' ],
],
'configuration' => [
'webhook' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Webhook URL', 'decalog' ),
'help' => esc_html__( 'The Webhook URL set in the Slack application.', 'decalog' ),
'default' => 'https://hooks.slack.com/services/...',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'short' => [
'type' => 'boolean',
'show' => true,
'name' => esc_html__( 'Short attachment', 'decalog' ),
'help' => esc_html__( 'Use a shortened version for attachments sent in channel.', 'decalog' ),
'default' => false,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
'data' => [
'type' => 'boolean',
'show' => true,
'name' => esc_html__( 'Full data', 'decalog' ),
'help' => esc_html__( 'Whether the attachments should include context and extra data.', 'decalog' ),
'default' => true,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'webhook',
],
[
'type' => 'literal',
'value' => null,
],
[
'type' => 'literal',
'value' => null,
],
[
'type' => 'literal',
'value' => true,
],
[
'type' => 'literal',
'value' => null,
],
[
'type' => 'configuration',
'value' => 'short',
],
[
'type' => 'configuration',
'value' => 'data',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'StackdriverHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Google Cloud Logging',
'help' => esc_html__( 'Events sent to Google Cloud Logging via a Google-Fluentd collector.', 'decalog' ),
'icon' => $this->get_base64_stackdriver_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Connection string', 'decalog' ),
'help' => esc_html__( 'Connection string to Fluentd. Can be something like "tcp://127.0.0.1:24224" or something like "unix:///var/run/td-agent/td-agent.sock".', 'decalog' ),
'default' => 'tcp://localhost:24224',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'timeout' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Socket timeout', 'decalog' ),
'help' => esc_html__( 'Max number of milliseconds to wait for the socket.', 'decalog' ),
'default' => 800,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 100,
'max' => 10000,
'step' => 100,
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'timeout',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'SumoSysHandler',
'namespace' => 'Decalog\\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Sumo Logic cloud-syslog',
'help' => esc_html__( 'Events sent to a Sumo Logic cloud-syslog source.', 'decalog' ),
'icon' => $this->get_base64_sumosys_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Region', 'decalog' ),
'help' => esc_html__( 'The deployment region of the cloud-syslog endpoint.', 'decalog' ),
'default' => 'syslog.collection.eu.sumologic.com',
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => true,
'list' => [ [ 'syslog.collection.au.sumologic.com', esc_html__( 'Australia', 'decalog' ) ], [ 'syslog.collection.ca.sumologic.com', esc_html__( 'Canada', 'decalog' ) ], [ 'syslog.collection.de.sumologic.com', esc_html__( 'Germany', 'decalog' ) ], [ 'syslog.collection.eu.sumologic.com', esc_html__( 'Europe', 'decalog' ) ], [ 'syslog.collection.jp.sumologic.com', esc_html__( 'Japan', 'decalog' ) ], [ 'syslog.collection.us1.sumologic.com', esc_html__( 'United States 1', 'decalog' ) ], [ 'syslog.collection.us2.sumologic.com', esc_html__( 'United States 2', 'decalog' ) ] ],
],
],
'token' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Source token', 'decalog' ),
'help' => esc_html__( 'The token of cloud-syslog source.', 'decalog' ),
'default' => '',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'proto' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Protocol', 'decalog' ),
'help' => esc_html__( 'The used cloud-syslog protocol.', 'decalog' ),
'default' => 'TCP',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => false,
],
],
'port' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Port', 'decalog' ),
'help' => esc_html__( 'The opened port on remote host to receive cloud-syslog messages.', 'decalog' ),
'default' => 6514,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 1,
'max' => 64738,
'step' => 1,
'enabled' => false,
],
],
'timeout' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Socket timeout', 'decalog' ),
'help' => esc_html__( 'Max number of milliseconds to wait for the socket.', 'decalog' ),
'default' => 800,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 100,
'max' => 10000,
'step' => 100,
'enabled' => true,
],
],
'facility' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Facility', 'decalog' ),
'help' => esc_html__( 'The cloud-syslog facility for messages sent by DecaLog.', 'decalog' ),
'default' => 'LOG_USER',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => false,
],
],
'ident' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Identifier', 'decalog' ),
'help' => esc_html__( 'The program identifier for messages sent by DecaLog.', 'decalog' ),
'default' => 'DecaLog',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'format' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Message format', 'decalog' ),
'help' => esc_html__( 'The syslog format standard to use.', 'decalog' ),
'default' => 1,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 0, 'BSD (RFC 3164)' ], [ 1, 'IETF (RFC 5424)' ], [ 2, 'IETF extended (RFC 5424)' ] ],
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'port',
],
[
'type' => 'configuration',
'value' => 'timeout',
],
[
'type' => 'configuration',
'value' => 'token',
],
[
'type' => 'literal',
'value' => 8,
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
[
'type' => 'configuration',
'value' => 'ident',
],
[
'type' => 'configuration',
'value' => 'format',
],
],
];
$this->handlers[] = [
'version' => DECALOG_MONOLOG_VERSION,
'id' => 'SyslogUdpHandler',
'namespace' => 'Monolog\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => 'Syslog',
'help' => esc_html__( 'Events sent to a remote syslogd server.', 'decalog' ),
'icon' => $this->get_base64_syslog_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'configuration' => [
'host' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Host', 'decalog' ),
'help' => esc_html__( 'The remote host receiving syslog messages.', 'decalog' ),
'default' => '127.0.0.1',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'proto' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Protocol', 'decalog' ),
'help' => esc_html__( 'The used syslog protocol.', 'decalog' ),
'default' => 'UDP',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => false,
],
],
'port' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Port', 'decalog' ),
'help' => esc_html__( 'The opened port on remote host to receive syslog messages.', 'decalog' ),
'default' => 514,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 1,
'max' => 64738,
'step' => 1,
'enabled' => true,
],
],
'facility' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Facility', 'decalog' ),
'help' => esc_html__( 'The syslog facility for messages sent by DecaLog.', 'decalog' ),
'default' => 'LOG_USER',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => false,
],
],
'ident' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Identifier', 'decalog' ),
'help' => esc_html__( 'The program identifier for messages sent by DecaLog.', 'decalog' ),
'default' => 'DecaLog',
'control' => [
'type' => 'field_input_text',
'cast' => 'string',
'enabled' => true,
],
],
'format' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Message format', 'decalog' ),
'help' => esc_html__( 'The syslog format standard to use.', 'decalog' ),
'default' => 1,
'control' => [
'type' => 'field_select',
'cast' => 'integer',
'enabled' => true,
'list' => [ [ 0, 'BSD (RFC 3164)' ], [ 1, 'IETF (RFC 5424)' ], [ 2, 'IETF extended (RFC 5424)' ] ],
],
],
],
'init' => [
[
'type' => 'configuration',
'value' => 'host',
],
[
'type' => 'configuration',
'value' => 'port',
],
[
'type' => 'literal',
'value' => 8,
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
[
'type' => 'configuration',
'value' => 'ident',
],
[
'type' => 'configuration',
'value' => 'format',
],
],
];
$this->handlers[] = [
'version' => DECALOG_VERSION,
'id' => 'WordpressHandler',
'namespace' => 'Decalog\Handler',
'class' => 'logging',
'minimal' => Logger::DEBUG,
'name' => esc_html__( 'WordPress events log', 'decalog' ),
'help' => esc_html__( 'Events stored in WordPress and available right in your admin dashboard.', 'decalog' ),
'icon' => $this->get_base64_wordpress_icon(),
'needs' => [],
'params' => [ 'processors', 'privacy' ],
'processors' => [
'included' => [ 'WordpressProcessor', 'WWWProcessor', 'IntrospectionProcessor' ],
],
'configuration' => [
'constant-storage' => [
'type' => 'string',
'show' => true,
'name' => esc_html__( 'Storage', 'decalog' ),
'help' => esc_html__( 'Place where to store events.', 'decalog' ) . '
' . esc_html__( 'Note: it\'s not possible to change storage type after logger creation.', 'decalog' ),
'default' => 'db',
'control' => [
'type' => 'field_select',
'cast' => 'string',
'enabled' => Cache::$apcu_available,
'list' => [ [ 'db', esc_html__( 'Database: persistent after a server restart', 'decalog' ) ], [ 'apcu', esc_html__( 'APCu: high performance but reset after each server reboot', 'decalog' ), Cache::$apcu_available ] ],
],
],
'rotate' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Events', 'decalog' ),
'help' => esc_html__( 'Maximum number of events stored in this events log (0 for no limit).', 'decalog' ),
'default' => 10000,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 0,
'max' => 10000000,
'step' => 1000,
'enabled' => true,
],
],
'purge' => [
'type' => 'integer',
'show' => true,
'name' => esc_html__( 'Days', 'decalog' ),
'help' => esc_html__( 'Maximum age of events stored in this events log (0 for no limit).', 'decalog' ),
'default' => 15,
'control' => [
'type' => 'field_input_integer',
'cast' => 'integer',
'min' => 0,
'max' => 730,
'step' => 1,
'enabled' => true,
],
],
'local' => [
'type' => 'boolean',
'show' => is_multisite(),
'name' => esc_html__( 'Multisite partitioning', 'decalog' ),
'help' => esc_html__( 'Local administrators can view events that relate to their site.', 'decalog' ),
'default' => false,
'control' => [
'type' => 'field_checkbox',
'cast' => 'boolean',
'enabled' => true,
],
],
],
'init' => [
[
'type' => 'compute',
'value' => 'tablename',
],
[
'type' => 'configuration',
'value' => 'constant-storage',
],
[ 'type' => 'level' ],
[
'type' => 'literal',
'value' => true,
],
],
];
uasort(
$this->handlers,
function ( $a, $b ) {
return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) );
}
);
}
/**
* Get the types definition.
*
* @return array A list of all available types definitions.
* @since 1.0.0
*/
public function get_all() {
return $this->handlers;
}
/**
* Get the tname for a specific class.
*
* @param string $class The class of loggers ( 'alerting', 'debugging', 'logging').
* @return string The name of the class.
* @since 3.0.0
*/
public function get_class_name( $class ) {
$result = '-';
if ( array_key_exists( $class, $this->handlers_class ) ) {
$result = $this->handlers_class[ $class ];
}
return $result;
}
/**
* Get the types definition for a specific class.
*
* @param string $class The class of loggers ( 'alerting', 'debugging', 'logging').
* @return array A list of all available types definitions.
* @since 1.2.0
*/
public function get_for_class( $class ) {
$result = [];
foreach ( $this->handlers as $handler ) {
if ( $handler['class'] === $class ) {
$result[] = $handler;
}
}
usort(
$result,
function( $a, $b ) {
return strcmp( strtolower( $a['name'] ), strtolower( $b['name'] ) );
}
);
return $result;
}
/**
* Get the types list.
*
* @return array A list of all available types.
* @since 1.0.0
*/
public function get_list() {
$result = [];
foreach ( $this->handlers as $handler ) {
$result[] = $handler['id'];
}
return $result;
}
/**
* Get a specific handler.
*
* @param string $id The handler id.
* @return null|array The detail of the handler, null if not found.
* @since 1.0.0
*/
public function get( $id ) {
foreach ( $this->handlers as $handler ) {
if ( $handler['id'] === $id ) {
return $handler;
}
}
return null;
}
/**
* Returns a base64 svg resource for the mail icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_mail_icon( $color = '#0073AA' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the PHP icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_php_icon( $color = '#777BB3' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the RAM icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_ram_icon( $color = '#808080' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the WordPress icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_wordpress_icon( $color = '#0073AA' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the WordPress icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_browserconsole_icon( $color = '#444466' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Chrome icon.
*
* @param string $color1 Optional. Color 1 of the icon.
* @param string $color2 Optional. Color 2 of the icon.
* @param string $color3 Optional. Color 3 of the icon.
* @param string $color4 Optional. Color 4 of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_chrome_icon( $color1 = '#EA4335', $color2 = '#4285F4', $color3 = '#34A853', $color4 = '#FBBC05' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the SysLog icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_syslog_icon( $color = '#983256' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the files icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_rotatingfiles_icon( $color = '#FF9920' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Bugsnag icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_bugsnag_icon( $color = '#000D47' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Sentry icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_sentry_icon( $color = '#362d59' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Raygun icon.
*
* @param string $color1 Optional. Color 1 of the icon.
* @param string $color2 Optional. Color 2 of the icon.
* @param string $color3 Optional. Color 3 of the icon.
* @param string $color4 Optional. Color 4 of the icon.
* @param string $color5 Optional. Color 5 of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_raygun_icon( $color1 = '#F4DB12', $color2 = '#DF282B', $color3 = '#D3D2D3', $color4 = '#C02123', $color5 = '#FFFFFF' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Raygun icon.
*
* @param string $color1 Optional. Color 1 of the icon.
* @param string $color2 Optional. Color 2 of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_ganalytics_icon( $color1 = '#F9AB00', $color2 = '#E37400' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Chrome icon.
*
* @param string $color1 Optional. Color 1 of the icon.
* @param string $color2 Optional. Color 2 of the icon.
* @param string $color3 Optional. Color 3 of the icon.
* @param string $color4 Optional. Color 4 of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_slack_icon( $color1 = '#36c5f0', $color2 = '#2eb67d', $color3 = '#ecb22e', $color4 = '#e01e5a' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Chrome icon.
*
* @param string $color1 Optional. Color 1 of the icon.
* @param string $color2 Optional. Color 2 of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_stackdriver_icon( $color1 = '#FFFFFF', $color2 = '#4386FA' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Pushover icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_pushover_icon( $color = '#249DF1' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Fluentd icon.
*
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_fluentd_icon() {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Logentrie icon.
*
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_logentries_icon() {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Loggly icon.
*
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_loggly_icon() {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Sematext icon.
*
* @param string $color Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_sematext_icon( $color = '#1fa0ed' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Elastic Cloud icon.
*
* @param string $color1 Optional. Color of the icon.
* @param string $color2 Optional. Color of the icon.
* @param string $color3 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_elasticcloud_icon( $color1 = '#00BFB3', $color2 = '#0077CC', $color3 = '#343741' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Elasticsearch icon.
*
* @param string $color1 Optional. Color of the icon.
* @param string $color2 Optional. Color of the icon.
* @param string $color3 Optional. Color of the icon.
* @param string $color4 Optional. Color of the icon.
* @param string $color5 Optional. Color of the icon.
* @param string $color6 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 2.4.0
*/
private function get_base64_elasticsearch_icon( $color1 = '#f0bf1a', $color2 = '#3ebeb0', $color3 = '#07a5de', $color4 = '#231f20', $color5 = '#d7a229', $color6 = '#019b8f' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Sumo icon.
*
* @param string $color1 Optional. Color of the icon.
* @param string $color2 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 1.0.0
*/
private function get_base64_sumosys_icon( $color1 = '#000099', $color2 = '#FEFEFE' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Sematext icon.
*
* @param string $color1 Optional. Color of the icon.
* @param string $color2 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 2.4.0
*/
private function get_base64_loki_icon( $color1 = '#F9EC1C', $color2 = '#F05A2B' ) {
$style = '';
for ( $i = 1; $i < 16; $i++ ) {
$style .= ' .st' . $i . '{fill:url(#SVGID_' . $i . '_);}';
}
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Grafana icon.
*
* @param string $color1 Optional. Color of the icon.
* @param string $color2 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 2.4.0
*/
private function get_base64_grafana_icon( $color1 = '#FFF100', $color2 = '#F05A28' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Prometheus icon.
*
* @param string $color1 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 3.0.0
*/
private function get_base64_prometheus_icon( $color1 = '#DA4E31' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the influxDB icon.
*
* @param string $color1 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 3.0.0
*/
private function get_base64_infuxdb_icon( $color1 = '#22ADF6' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Tempo icon.
*
* @param string $color1 Optional. Color 1 of the icon.
* @param string $color2 Optional. Color 2 of the icon.
* @return string The svg resource as a base64.
* @since 3.0.0
*/
private function get_base64_tempo_icon( $color1 = '#fff100', $color2 = '#f05a28' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Zipkin icon.
*
* @param string $color1 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 3.0.0
*/
private function get_base64_zipkin_icon( $color1 = '#EC7849' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Jaeger icon.
*
* @param string $color1 Optional. Color of the icon.
* @param string $color2 Optional. Color of the icon.
* @param string $color3 Optional. Color of the icon.
* @param string $color4 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 3.0.0
*/
private function get_base64_jaeger_icon( $color1 = '#231f20', $color2 = '#67cfe3', $color3 = '#dfcaa3', $color4 = '#648c1a' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
/**
* Returns a base64 svg resource for the Zipkin icon.
*
* @param string $color1 Optional. Color of the icon.
* @return string The svg resource as a base64.
* @since 3.0.0
*/
private function get_base64_datadog_icon( $color1 = '#632CA6' ) {
$source = '';
// phpcs:ignore
return 'data:image/svg+xml;base64,' . base64_encode( $source );
}
}