kba-team/graylog-utilities

Utilities for logging

v2.0.0 2020-06-26 10:25 UTC

This package is auto-updated.

Last update: 2022-07-26 16:19:00 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) "********"
}