|
1
|
|
|
<?php declare (strict_types=1); |
|
2
|
|
|
/** |
|
3
|
|
|
* @license MIT |
|
4
|
|
|
* @author Samuel Adeshina <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* This file is part of the EmmetBlue project, please read the license document |
|
7
|
|
|
* available in the root level of the project |
|
8
|
|
|
*/ |
|
9
|
|
|
namespace EmmetBlue\Core\Logger; |
|
10
|
|
|
|
|
11
|
|
|
use EmmetBlue\Core\Builder\BuilderFactory as Builder; |
|
12
|
|
|
use EmmetBlue\Core\Factory\DatabaseConnectionFactory as DBConnectionFactory; |
|
13
|
|
|
use EmmetBlue\Core\Builder\QueryBuilder\QueryBuilder as QB; |
|
14
|
|
|
use EmmetBlue\Core\Exception\SQLException; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class ErrorLog |
|
18
|
|
|
* |
|
19
|
|
|
* @author Samuel Adeshina <[email protected]> |
|
20
|
|
|
* |
|
21
|
|
|
* @since v0.0.1 08/06/2016 14:20 |
|
22
|
|
|
*/ |
|
23
|
|
|
class ErrorLog implements LogInterface |
|
24
|
|
|
{ |
|
25
|
|
|
public static function logDeprecated(int $databaseUserId, string $errorNumber, string $errorSeverity, string $errorMessage, string $errorObject=null) |
|
|
|
|
|
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* For now I am not doing anything with $errorObject yet. |
|
29
|
|
|
* |
|
30
|
|
|
* As soon as it can be properly serialized for the MSSQL Server db |
|
31
|
|
|
* it shall be saved in the database. |
|
32
|
|
|
* |
|
33
|
|
|
* FUNNY: I'M GONNA INTENTIONALLY LEAVE THIS COMMIT FOR MY AMUSEMENT |
|
34
|
|
|
* $errorObject, wasn't the issue. My DB schema was. |
|
35
|
|
|
*/ |
|
36
|
|
|
$insertBuilder = (new Builder("QueryBuilder", "Insert"))->getBuilder(); |
|
37
|
|
|
|
|
38
|
|
|
$insertBuilder |
|
39
|
|
|
->into(' |
|
40
|
|
|
[Logs].[ErrorLog] |
|
41
|
|
|
( |
|
42
|
|
|
ErrorTime, |
|
43
|
|
|
DatabaseUserId, |
|
44
|
|
|
ErrorNumber, |
|
45
|
|
|
ErrorSeverity, |
|
46
|
|
|
ErrorMessage |
|
47
|
|
|
) |
|
48
|
|
|
') |
|
49
|
|
|
->values([ |
|
50
|
|
|
'GETDATE()', |
|
51
|
|
|
$databaseUserId, |
|
52
|
|
|
QB::wrapString($errorNumber, "'"), |
|
53
|
|
|
QB::wrapString($errorSeverity, "'"), |
|
54
|
|
|
QB::wrapString($errorMessage, "'") |
|
55
|
|
|
]); |
|
56
|
|
|
|
|
57
|
|
|
DBConnectionFactory::getConnection()->query((string)$insertBuilder); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public static function log(int $databaseUserId, string $errorNumber, string $errorSeverity, string $errorMessage, string $errorObject=null) { |
|
|
|
|
|
|
61
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.