ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Logging\TestLogger Class Reference
+ Inheritance diagram for ILIAS\Test\Logging\TestLogger:
+ Collaboration diagram for ILIAS\Test\Logging\TestLogger:

Public Member Functions

 __construct (private readonly TestLoggingSettings $logging_settings, private readonly TestLoggingRepository $logging_repository, private readonly Factory $interaction_factory, private readonly AdditionalInformationGenerator $additional_information, private readonly \ilComponentLogger $component_logger,)
 
 isLoggingEnabled ()
 
 isIPLoggingEnabled ()
 
 testHasParticipantInteractions (int $ref_id)
 
 deleteParticipantInteractionsForTest (int $ref_id)
 
 logTestAdministrationInteraction (TestAdministrationInteraction $interaction)
 
 logQuestionAdministrationInteraction (TestQuestionAdministrationInteraction $interaction)
 
 logParticipantInteraction (TestParticipantInteraction $interaction)
 
 logScoringInteraction (TestScoringInteraction $interaction)
 
 emergency (string|\Stringable $message, array $context=[])
 
 alert (string|\Stringable $message, array $context=[])
 
 critical (string|\Stringable $message, array $context=[])
 
 error (string|\Stringable $message, array $context=[])
 
 warning (string|\Stringable $message, array $context=[])
 
 notice (string|\Stringable $message, array $context=[])
 
 info (string|\Stringable $message, array $context=[])
 
 debug (string|\Stringable $message, array $context=[])
 
 log ($level, string|\Stringable $message, mixed $context=[])
 
 getComponentLogger ()
 
 getInteractionFactory ()
 
 getAdditionalInformationGenerator ()
 
 getLogEntryTypes ()
 
 getInteractionTypes ()
 

Private Member Functions

 createTestErrorFromContext (array $context, string $message)
 

Private Attributes

const LOG_ENTRY_TYPES
 

Detailed Description

Definition at line 27 of file TestLogger.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Logging\TestLogger::__construct ( private readonly TestLoggingSettings  $logging_settings,
private readonly TestLoggingRepository  $logging_repository,
private readonly Factory  $interaction_factory,
private readonly AdditionalInformationGenerator  $additional_information,
private readonly \ilComponentLogger  $component_logger 
)

Definition at line 36 of file TestLogger.php.

42 {
43 }

Member Function Documentation

◆ alert()

ILIAS\Test\Logging\TestLogger::alert ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 98 of file TestLogger.php.

98 : void
99 {
100 $this->component_logger->alert($message, $context);
101
102 if (!$this->logging_settings->isLoggingEnabled()
103 || !isset($context['ref_id'])) {
104 return;
105 }
106
107 $this->logging_repository->storeError(
109 );
110 }
createTestErrorFromContext(array $context, string $message)
Definition: TestLogger.php:206
$context
Definition: webdav.php:31
$message
Definition: xapiexit.php:31

References $context, $message, and ILIAS\Test\Logging\TestLogger\createTestErrorFromContext().

+ Here is the call graph for this function:

◆ createTestErrorFromContext()

ILIAS\Test\Logging\TestLogger::createTestErrorFromContext ( array  $context,
string  $message 
)
private

Definition at line 206 of file TestLogger.php.

206 : TestError
207 {
208 return new TestError(
209 $context['ref_id'],
210 $context ['question_id'] ?? null,
211 $context['administrator'] ?? null,
212 $context['participant'] ?? null,
214 $context['timestamp'] ?? time(),
216 );
217 }

References $context, $message, and ILIAS\Test\Logging\ERROR_ON_UNDEFINED_INTERACTION.

Referenced by ILIAS\Test\Logging\TestLogger\alert(), ILIAS\Test\Logging\TestLogger\critical(), ILIAS\Test\Logging\TestLogger\emergency(), ILIAS\Test\Logging\TestLogger\error(), and ILIAS\Test\Logging\TestLogger\log().

+ Here is the caller graph for this function:

◆ critical()

ILIAS\Test\Logging\TestLogger::critical ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 112 of file TestLogger.php.

112 : void
113 {
114 $this->component_logger->critical($message, $context);
115
116 if (!$this->logging_settings->isLoggingEnabled()
117 || !isset($context['ref_id'])) {
118 return;
119 }
120
121 $this->logging_repository->storeError(
123 );
124 }

References $context, $message, and ILIAS\Test\Logging\TestLogger\createTestErrorFromContext().

+ Here is the call graph for this function:

◆ debug()

ILIAS\Test\Logging\TestLogger::debug ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 154 of file TestLogger.php.

154 : void
155 {
156 $this->component_logger->debug($message, $context);
157 }

References $context, and $message.

◆ deleteParticipantInteractionsForTest()

ILIAS\Test\Logging\TestLogger::deleteParticipantInteractionsForTest ( int  $ref_id)

Definition at line 60 of file TestLogger.php.

60 : void
61 {
62 $this->logging_repository->deleteParticipantInteractionsForTest($ref_id);
63 }
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ emergency()

ILIAS\Test\Logging\TestLogger::emergency ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 85 of file TestLogger.php.

85 : void
86 {
87 $this->component_logger->emergency($message, $context);
88
89 if (!$this->logging_settings->isLoggingEnabled()
90 || !isset($context['ref_id'])) {
91 return;
92 }
93
94 $this->logging_repository->storeError(
96 );
97 }

References $context, $message, and ILIAS\Test\Logging\TestLogger\createTestErrorFromContext().

+ Here is the call graph for this function:

◆ error()

ILIAS\Test\Logging\TestLogger::error ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 125 of file TestLogger.php.

125 : void
126 {
127
128 if (!$this->logging_settings->isLoggingEnabled()
129 || !isset($context['ref_id'])) {
130 return;
131 }
132
133 $this->logging_repository->storeError(
135 );
136 $this->component_logger->error($message, $context);
137 }

References $context, $message, and ILIAS\Test\Logging\TestLogger\createTestErrorFromContext().

+ Here is the call graph for this function:

◆ getAdditionalInformationGenerator()

ILIAS\Test\Logging\TestLogger::getAdditionalInformationGenerator ( )

Definition at line 184 of file TestLogger.php.

◆ getComponentLogger()

ILIAS\Test\Logging\TestLogger::getComponentLogger ( )

Definition at line 174 of file TestLogger.php.

175 {
176 return $this->component_logger;
177 }
Component logger with individual log levels by component id.

◆ getInteractionFactory()

ILIAS\Test\Logging\TestLogger::getInteractionFactory ( )

Definition at line 179 of file TestLogger.php.

179 : Factory
180 {
181 return $this->interaction_factory;
182 }

◆ getInteractionTypes()

ILIAS\Test\Logging\TestLogger::getInteractionTypes ( )

Definition at line 197 of file TestLogger.php.

197 : array
198 {
199 $interaction_types = [];
200 foreach (self::LOG_ENTRY_TYPES as $type => $enum_class) {
201 $interaction_types[$type] = array_column($enum_class::cases(), 'value');
202 }
203 return $interaction_types;
204 }

◆ getLogEntryTypes()

ILIAS\Test\Logging\TestLogger::getLogEntryTypes ( )
Returns
array<string>

Definition at line 192 of file TestLogger.php.

192 : array
193 {
194 return array_keys(self::LOG_ENTRY_TYPES);
195 }

◆ info()

ILIAS\Test\Logging\TestLogger::info ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 149 of file TestLogger.php.

149 : void
150 {
151 $this->component_logger->info($message, $context);
152 }

References $context, and $message.

◆ isIPLoggingEnabled()

ILIAS\Test\Logging\TestLogger::isIPLoggingEnabled ( )

Definition at line 50 of file TestLogger.php.

50 : bool
51 {
52 return $this->logging_settings->isIPLoggingEnabled();
53 }

◆ isLoggingEnabled()

ILIAS\Test\Logging\TestLogger::isLoggingEnabled ( )

Definition at line 45 of file TestLogger.php.

45 : bool
46 {
47 return $this->logging_settings->isLoggingEnabled();
48 }

◆ log()

ILIAS\Test\Logging\TestLogger::log (   $level,
string|\Stringable  $message,
mixed  $context = [] 
)

Definition at line 159 of file TestLogger.php.

159 : void
160 {
161 $this->component_logger->log($message, $level, $context);
162
163 if (!$this->logging_settings->isLoggingEnabled()
164 || intval($level) < \ilLogLevel::ERROR
165 || !isset($context['ref_id'])) {
166 return;
167 }
168
169 $this->logging_repository->storeError(
171 );
172 }

References $context, $message, ILIAS\Test\Logging\TestLogger\createTestErrorFromContext(), and ilLogLevel\ERROR.

+ Here is the call graph for this function:

◆ logParticipantInteraction()

ILIAS\Test\Logging\TestLogger::logParticipantInteraction ( TestParticipantInteraction  $interaction)

Definition at line 75 of file TestLogger.php.

75 : void
76 {
77 $this->logging_repository->storeParticipantInteraction($interaction);
78 }

◆ logQuestionAdministrationInteraction()

ILIAS\Test\Logging\TestLogger::logQuestionAdministrationInteraction ( TestQuestionAdministrationInteraction  $interaction)

Definition at line 70 of file TestLogger.php.

70 : void
71 {
72 $this->logging_repository->storeQuestionAdministrationInteraction($interaction);
73 }

◆ logScoringInteraction()

ILIAS\Test\Logging\TestLogger::logScoringInteraction ( TestScoringInteraction  $interaction)

Definition at line 80 of file TestLogger.php.

80 : void
81 {
82 $this->logging_repository->storeScoringInteraction($interaction);
83 }

◆ logTestAdministrationInteraction()

ILIAS\Test\Logging\TestLogger::logTestAdministrationInteraction ( TestAdministrationInteraction  $interaction)

Definition at line 65 of file TestLogger.php.

65 : void
66 {
67 $this->logging_repository->storeTestAdministrationInteraction($interaction);
68 }

◆ notice()

ILIAS\Test\Logging\TestLogger::notice ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 144 of file TestLogger.php.

144 : void
145 {
146 $this->component_logger->notice($message, $context);
147 }

References $context, and $message.

◆ testHasParticipantInteractions()

ILIAS\Test\Logging\TestLogger::testHasParticipantInteractions ( int  $ref_id)

Definition at line 55 of file TestLogger.php.

55 : bool
56 {
57 return $this->logging_repository->testHasParticipantInteractions($ref_id);
58 }

References $ref_id.

◆ warning()

ILIAS\Test\Logging\TestLogger::warning ( string|\Stringable  $message,
array  $context = [] 
)

Definition at line 139 of file TestLogger.php.

139 : void
140 {
141 $this->component_logger->warning($message, $context);
142 }

References $context, and $message.

Field Documentation

◆ LOG_ENTRY_TYPES

const ILIAS\Test\Logging\TestLogger::LOG_ENTRY_TYPES
private

The documentation for this class was generated from the following file: