kba-team/graylog-utilities

Utilities for logging

v2.0.2 2024-04-03 14:37 UTC

This package is auto-updated.

Last update: 2024-11-03 16:00:50 UTC


README

License: MIT Packagist Version Build Status Maintainability Test Coverage

Utilities for logging.

Usage

composer requrire kba-team/graylog-utilities

LogTypes

<?php
$logTypes = new \kbATeam\GraylogUtilities\LogTypes();
$logTypes->add(\Psr\Log\LogLevel::ALERT);
$logTypes->add(\Psr\Log\LogLevel::CRITICAL);
var_dump($logTypes->get());

Output:

array(2) {
  [0]=>
  string(5) "alert"
  [1]=>
  string(8) "critical"
}

Obfuscator

<?php
$obfuscator = new \kbATeam\GraylogUtilities\Obfuscator();
$obfuscator->addKey('password');
$data = [
    'foo' => 'bar',
    'password' => 'secret'
];
var_dump($obfuscator->obfuscate($data));

Output:

array(2) {
  ["foo"]=>
  string(3) "bar"
  ["password"]=>
  string(6) "********"
}