1 | <?php |
||||
2 | /* |
||||
3 | * Functions relative to debugging |
||||
4 | */ |
||||
5 | |||||
6 | /** |
||||
7 | * Add a message to the debug log |
||||
8 | * |
||||
9 | * When in debug mode ( YOURLS_DEBUG == true ) the debug log is echoed in yourls_html_footer() |
||||
10 | * Log messages are appended to $ydb->debug_log array, which is instanciated within class ezSQLcore_YOURLS |
||||
11 | * |
||||
12 | * @since 1.7 |
||||
13 | * @param string $msg Message to add to the debug log |
||||
14 | * @return string The message itself |
||||
15 | */ |
||||
16 | function yourls_debug_log( $msg ) { |
||||
17 | 4 | yourls_do_action( 'debug_log', $msg ); |
|||
18 | 4 | yourls_get_db()->getProfiler()->log( $msg ); |
|||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
19 | 4 | return $msg; |
|||
20 | } |
||||
21 | |||||
22 | /** |
||||
23 | * Get the debug log |
||||
24 | * |
||||
25 | * @since 1.7.3 |
||||
26 | * @return array |
||||
27 | */ |
||||
28 | function yourls_get_debug_log() { |
||||
29 | 1 | $profiler = yourls_get_db()->getProfiler(); |
|||
30 | 1 | return $profiler instanceof \Aura\Sql\ProfilerInterface ? $profiler->get_log() : []; |
|||
0 ignored issues
–
show
The method
get_log() does not exist on Aura\Sql\ProfilerInterface . It seems like you code against a sub-type of Aura\Sql\ProfilerInterface such as YOURLS\Admin\Logger .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
31 | } |
||||
32 | |||||
33 | /** |
||||
34 | * Debug mode set |
||||
35 | * |
||||
36 | * @since 1.7.3 |
||||
37 | * @param bool $bool Debug on or off |
||||
38 | */ |
||||
39 | function yourls_debug_mode( $bool ) { |
||||
40 | // log queries if true |
||||
41 | 1 | yourls_get_db()->getProfiler()->setActive( (bool)$bool ); |
|||
42 | |||||
43 | // report notices if true |
||||
44 | 1 | $level = $bool ? -1 : ( E_ERROR | E_PARSE ); |
|||
45 | 1 | error_reporting( $level ); |
|||
46 | 1 | } |
|||
47 | |||||
48 | /** |
||||
49 | * Return YOURLS debug mode |
||||
50 | * |
||||
51 | * @since 1.7.7 |
||||
52 | * @return bool |
||||
53 | */ |
||||
54 | function yourls_get_debug_mode() { |
||||
55 | 1 | return defined( 'YOURLS_DEBUG' ) && YOURLS_DEBUG; |
|||
56 | } |
||||
57 |