-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLogHelperPlugin.php
91 lines (81 loc) · 2.04 KB
/
LogHelperPlugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
namespace Craft;
/**
* Log Helper Plugin.
*
* Advanced logging options
*
* @author Nerds & Company
* @copyright Copyright (c) 2016, Nerds & Company
*
* @link https://www.nerds.company
*/
class LogHelperPlugin extends BasePlugin
{
/**
* Return plugin name.
*
* @return string
*/
public function getName()
{
return Craft::t('Log Helper');
}
/**
* Return plugin version.
*
* @return string
*/
public function getVersion()
{
return '2.0.2';
}
/**
* Return developer name.
*
* @return string
*/
public function getDeveloper()
{
return 'Nerds & Company';
}
/**
* Return developer url.
*
* @return string
*/
public function getDeveloperUrl()
{
return 'https://www.nerds.company';
}
/**
* Initialize plugin.
*/
public function init()
{
// Disable web logging?
if (!craft()->config->get('useWebLog', 'logHelper')) {
craft()->log->removeRoute('WebLogRoute');
}
// Disable file logging?
if (!craft()->config->get('useFileLog', 'logHelper')) {
craft()->log->removeRoute('FileLogRoute');
}
// Disable profile logging?
if (!craft()->config->get('useProfileLog', 'logHelper')) {
craft()->log->removeRoute('ProfileLogRoute');
}
// Use STDERR logging?
if (craft()->config->get('useStdErrLog', 'logHelper')) {
require_once __DIR__.'/logging/LogHelper_BaseLogRoute.php';
require_once __DIR__.'/logging/LogHelper_StdErrLogRoute.php';
craft()->log->addRoute('Craft\LogHelper_StdErrLogRoute');
}
// Use SysLog logging?
if (craft()->config->get('useSysLog', 'logHelper')) {
require_once __DIR__.'/logging/LogHelper_BaseLogRoute.php';
require_once __DIR__.'/logging/LogHelper_SysLogRoute.php';
craft()->log->addRoute('Craft\LogHelper_SysLogRoute');
}
}
}