File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -58,4 +58,32 @@ public function it_should_not_have_any_processor_if_the_config_does_not_have_pro
5858
5959 $ handler ->popProcessor ();
6060 }
61+
62+ /** @test */
63+ public function it_should_set_system_name_to_current_hostname_if_system_name_is_null (): void
64+ {
65+ $ this ->app ['config ' ]->set ('logging.channels.gelf ' , [
66+ 'system_name ' => null ,
67+ 'driver ' => 'custom ' ,
68+ 'via ' => GelfLoggerFactory::class
69+ ]);
70+
71+ $ logger = Log::channel ('gelf ' );
72+
73+ $ this ->assertAttributeEquals (gethostname (), 'systemName ' , $ logger ->getHandlers ()[0 ]->getFormatter ());
74+ }
75+
76+ /** @test */
77+ public function it_should_set_system_name_to_custom_value_if_system_name_config_is_provided (): void
78+ {
79+ $ this ->app ['config ' ]->set ('logging.channels.gelf ' , [
80+ 'system_name ' => 'my-system-name ' ,
81+ 'driver ' => 'custom ' ,
82+ 'via ' => GelfLoggerFactory::class
83+ ]);
84+
85+ $ logger = Log::channel ('gelf ' );
86+
87+ $ this ->assertAttributeEquals ('my-system-name ' , 'systemName ' , $ logger ->getHandlers ()[0 ]->getFormatter ());
88+ }
6189}
You can’t perform that action at this time.
0 commit comments