@@ -133,6 +133,56 @@ public function it_should_call_the_udp_transport_method_when_nothing_is_provided
133133 $ this ->assertInstanceOf (UdpTransport::class, $ transport );
134134 }
135135
136+ /** @test */
137+ public function it_should_set_max_length_if_max_length_is_provided (): void
138+ {
139+ $ this ->app ['config ' ]->set ('logging.channels.gelf ' , [
140+ 'driver ' => 'custom ' ,
141+ 'via ' => GelfLoggerFactory::class,
142+ 'max_length ' => 9999
143+ ]);
144+
145+ $ logger = Log::channel ('gelf ' );
146+
147+ $ this ->assertSame (
148+ 9999 ,
149+ $ this ->getAttribute ($ logger ->getHandlers ()[0 ]->getFormatter (), 'maxLength ' )
150+ );
151+ }
152+
153+ /** @test */
154+ public function it_should_use_default_max_length_when_max_length_is_not_provided (): void
155+ {
156+ $ this ->app ['config ' ]->set ('logging.channels.gelf ' , [
157+ 'driver ' => 'custom ' ,
158+ 'via ' => GelfLoggerFactory::class
159+ ]);
160+
161+ $ logger = Log::channel ('gelf ' );
162+
163+ $ this ->assertSame (
164+ GelfMessageFormatter::DEFAULT_MAX_LENGTH ,
165+ $ this ->getAttribute ($ logger ->getHandlers ()[0 ]->getFormatter (), 'maxLength ' )
166+ );
167+ }
168+
169+ /** @test */
170+ public function it_should_use_default_max_length_when_max_length_is_null (): void
171+ {
172+ $ this ->app ['config ' ]->set ('logging.channels.gelf ' , [
173+ 'driver ' => 'custom ' ,
174+ 'via ' => GelfLoggerFactory::class,
175+ 'max_length ' => null
176+ ]);
177+
178+ $ logger = Log::channel ('gelf ' );
179+
180+ $ this ->assertSame (
181+ GelfMessageFormatter::DEFAULT_MAX_LENGTH ,
182+ $ this ->getAttribute ($ logger ->getHandlers ()[0 ]->getFormatter (), 'maxLength ' )
183+ );
184+ }
185+
136186 /**
137187 * Get protected or private attribute from an object.
138188 * NOTICE: This method is for testing purposes only.
0 commit comments