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
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
],
"require": {
"php": "^7.2||^8.0",
"psr/log": "^1.0.1",
"psr/log": "^1.0.1 || ^2.0 || ^3.0",
"ext-json": "*"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.3.0",
"squizlabs/php_codesniffer": "3.*",
"brianium/paratest": "^3.1",
"monolog/monolog": "^2.0"
"squizlabs/php_codesniffer": "^3.7",
"brianium/paratest": "^6.6",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These updates are required to be able to run tests with PHP 8.

"monolog/monolog": "^2.5"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although still compatible with monolog < 2.5, ^2.5 is required for tests

},
"autoload": {
"psr-4": {"Elastic\\": "src/Elastic"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ElasticCommonSchemaFormatter extends NormalizerFormatter
{
private const ECS_VERSION = '1.2.0';

private static $logOriginKeys = ['file' => true, 'line' => true, 'class' => true, 'function' => true];
private static $logOriginKeys = ['file' => true, 'line' => true, 'class' => true, 'function' => true, 'callType' => true];

/**
* @var array
Expand Down Expand Up @@ -190,7 +190,10 @@ private function formatLogOrigin(array $inContext, array &$outRecord): void
if (array_key_exists('class', $inContext)) {
$inClassVal = $inContext['class'];
if (is_string($inClassVal)) {
$outFunctionVal = $inClassVal . '::' . $inFunctionVal;
$callType = array_key_exists('callType', $inContext) && is_string($inContext['callType'])
? $inContext['callType']
: '::';
$outFunctionVal = $inClassVal . $callType . $inFunctionVal;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/Elastic/Types/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

class BaseType
{

/**
* Get the Popo as array
*
Expand Down
1 change: 0 additions & 1 deletion src/Elastic/Types/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
class Service extends BaseType implements JsonSerializable
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion src/Elastic/Types/Tracing.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
class Tracing extends BaseType implements JsonSerializable
{

/**
* Unique identifier of the trace
*
Expand Down
1 change: 0 additions & 1 deletion src/Elastic/Types/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
class User extends BaseType implements JsonSerializable
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Elastic/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class BaseTestCase extends TestCase
{

/**
* @return string
*/
Expand Down
1 change: 1 addition & 0 deletions tests/Elastic/HelperForMonolog.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class HelperForMonolog
{
public static function logEmergency(Logger $logger, string $message, array &$logOrigin): void
{
$logOrigin['callType'] = '::';
$logOrigin['class'] = __CLASS__;
$logOrigin['function'] = __FUNCTION__;
$logOrigin['file'] = __FILE__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public function testsIntrospectionProcessor(bool $useLogOriginFromContext)
if ($useLogOriginFromContext) {
$testHelper->expectedAdditionalLogKeys = ['origin'];
} else {
$testHelper->expectedAdditionalTopLevelKeys = ['file', 'line', 'class', 'function'];
$testHelper->expectedAdditionalTopLevelKeys = ['file', 'line', 'class', 'callType', 'function'];
}

$logOrigin = [];
Expand All @@ -449,7 +449,7 @@ function (Logger $logger) use ($testHelper, &$logOrigin) {
if ($useLogOriginFromContext) {
self::assertSame($logOrigin['file'], $decodedJson['log']['origin']['file']['name']);
self::assertSame($logOrigin['line'], $decodedJson['log']['origin']['file']['line']);
self::assertSame($logOrigin['class'] . '::' . $logOrigin['function'], $decodedJson['log']['origin']['function']);
self::assertSame($logOrigin['class'] . $logOrigin['callType'] . $logOrigin['function'], $decodedJson['log']['origin']['function']);
} else {
self::assertArrayNotHasKey('origin', $decodedJson['log']);
}
Expand Down
1 change: 0 additions & 1 deletion tests/Elastic/Types/BaseTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class BaseTypeTest extends BaseTestCase
{

/**
* @covers Elastic\Types\BaseType::toArray
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Elastic/Types/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class ErrorTest extends BaseTestCase
{

/**
* @covers \Elastic\Types\Error::__construct
* @covers \Elastic\Types\Error::jsonSerialize
Expand Down
1 change: 0 additions & 1 deletion tests/Elastic/Types/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class ServiceTest extends BaseTestCase
{

/**
* @covers Elastic\Types\Service::__construct
* @covers Elastic\Types\Service::jsonSerialize
Expand Down
1 change: 0 additions & 1 deletion tests/Elastic/Types/TracingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class TracingTest extends BaseTestCase
{

/**
* @covers Elastic\Types\Tracing::__construct
* @covers Elastic\Types\Tracing::jsonSerialize
Expand Down
1 change: 0 additions & 1 deletion tests/Elastic/Types/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class UserTest extends BaseTestCase
{

/**
* @covers Elastic\Types\User::__construct
* @covers Elastic\Types\User::jsonSerialize
Expand Down