Failed Conditions
Push — pr/3408 ( 278c84 )
by Kiyotaka
06:25
created

log.php ➔ logs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
function log_emergency($message, array $context = [])
15
{
16
    $app = \Eccube\Application::getInstance();
17
    if (isset($app['eccube.logger'])) {
18
        $app['eccube.logger']->emergency($message, $context);
19
    }
20
}
21
22
function log_alert($message, array $context = [])
23
{
24
    $app = \Eccube\Application::getInstance();
25
    if (isset($app['eccube.logger'])) {
26
        $app['eccube.logger']->alert($message, $context);
27
    }
28
}
29
30
function log_critical($message, array $context = [])
31
{
32
    $app = \Eccube\Application::getInstance();
33
    if (isset($app['eccube.logger'])) {
34
        $app['eccube.logger']->critical($message, $context);
35
    }
36
}
37
38
function log_error($message, array $context = [])
39
{
40
    $app = \Eccube\Application::getInstance();
41
    if (isset($app['eccube.logger'])) {
42
        $app['eccube.logger']->error($message, $context);
43
    }
44
}
45
46
function log_warning($message, array $context = [])
47
{
48
    $app = \Eccube\Application::getInstance();
49
    if (isset($app['eccube.logger'])) {
50
        $app['eccube.logger']->warning($message, $context);
51
    }
52
}
53
54
function log_notice($message, array $context = [])
55
{
56
    $app = \Eccube\Application::getInstance();
57
    if (isset($app['eccube.logger'])) {
58
        $app['eccube.logger']->notice($message, $context);
59
    }
60
}
61
62
function log_info($message, array $context = [])
63
{
64
    $app = \Eccube\Application::getInstance();
65
    if (isset($app['eccube.logger'])) {
66
        $app['eccube.logger']->info($message, $context);
67
    }
68
}
69
70
function log_debug($message, array $context = [])
71
{
72
    $app = \Eccube\Application::getInstance();
73
    if (isset($app['eccube.logger'])) {
74
        $app['eccube.logger']->debug($message, $context);
75
    }
76
}
77
78
/**
79
 * プラグイン用ログ出力関数
80
 *
81
 * @param $channel 設定されたchannel名
82
 *
83
 * @return \Symfony\Bridge\Monolog\Logger
84
 */
85
function logs($channel)
86
{
87
    $app = \Eccube\Application::getInstance();
88
89
    $container = $app->getParentContainer();
90
91
    return $container->get('monolog.logger.'.$channel);
92
}
93