ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
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 26 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 35 of file TestLogger.php.

41 {
42 }

Member Function Documentation

◆ alert()

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

Definition at line 97 of file TestLogger.php.

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

References 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 205 of file TestLogger.php.

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

References 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 111 of file TestLogger.php.

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

References 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 153 of file TestLogger.php.

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

◆ deleteParticipantInteractionsForTest()

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

Definition at line 59 of file TestLogger.php.

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

References $ref_id.

◆ emergency()

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

Definition at line 84 of file TestLogger.php.

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

References 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 124 of file TestLogger.php.

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

References ILIAS\Test\Logging\TestLogger\createTestErrorFromContext().

+ Here is the call graph for this function:

◆ getAdditionalInformationGenerator()

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

Definition at line 183 of file TestLogger.php.

◆ getComponentLogger()

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

Definition at line 173 of file TestLogger.php.

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

◆ getInteractionFactory()

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

Definition at line 178 of file TestLogger.php.

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

◆ getInteractionTypes()

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

Definition at line 196 of file TestLogger.php.

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

◆ getLogEntryTypes()

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

Definition at line 191 of file TestLogger.php.

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

◆ info()

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

Definition at line 148 of file TestLogger.php.

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

◆ isIPLoggingEnabled()

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

Definition at line 49 of file TestLogger.php.

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

◆ isLoggingEnabled()

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

Definition at line 44 of file TestLogger.php.

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

◆ log()

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

Definition at line 158 of file TestLogger.php.

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

References 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 74 of file TestLogger.php.

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

◆ logQuestionAdministrationInteraction()

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

Definition at line 69 of file TestLogger.php.

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

◆ logScoringInteraction()

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

Definition at line 79 of file TestLogger.php.

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

◆ logTestAdministrationInteraction()

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

Definition at line 64 of file TestLogger.php.

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

◆ notice()

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

Definition at line 143 of file TestLogger.php.

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

◆ testHasParticipantInteractions()

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

Definition at line 54 of file TestLogger.php.

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

References $ref_id.

◆ warning()

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

Definition at line 138 of file TestLogger.php.

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

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: