Skip to content

Commit 923761b

Browse files
committed
ICL: Initialize log messages added.
1 parent a1787f4 commit 923761b

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/Loggable.php

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,20 @@ protected function initializeLogging()
2424
$log = new Logger('ICL', $this->getLogHandlers());
2525
ErrorHandler::register($log);
2626

27-
$log->info('Hello World!');
28-
$log->info('Message with context!', [
29-
'isOkay' => true,
30-
'count' => 3000,
31-
'type' => 'cool',
32-
'objects' => [
33-
[
34-
'name' => 'First',
35-
'date' => '2016-06-17 14:15:58',
36-
],
37-
[
38-
'name' => 'Second',
39-
'date' => '2016-06-17 15:15:58',
40-
],
41-
[
42-
'name' => 'Third',
43-
'date' => '2016-06-17 16:15:58',
44-
],
45-
],
46-
]);
47-
$log->error('Error Test!');
27+
$class = get_class($this);
28+
$host = gethostname();
29+
$ip = gethostbyname($host);
30+
$log->info("Command `{$class}` initialized.");
31+
$log->info("Host: `{$host}` (`{$ip}`).");
32+
33+
if (laravel_db_is_mysql()) {
34+
$dbIp = (string) laravel_db_mysql_variable('wsrep_node_address');
35+
$dbHost = (string) laravel_db_mysql_variable('hostname');
36+
$dbPort = (string) laravel_db_mysql_variable('port');
37+
$now = laravel_db_mysql_now();
38+
$log->info("Database host: `{$dbHost}`, port: `{$dbPort}`, ip: `{$dbIp}`.");
39+
$log->info("Database date: `{$now}`.");
40+
}
4841
}
4942

5043
private function getLogHandlers()

0 commit comments

Comments
 (0)