1 | <?php |
||
17 | class LogEntry extends DataObject implements PermissionProvider |
||
18 | { |
||
19 | private static $table_name = 'LogEntry'; |
||
20 | |||
21 | private static $db = [ |
||
22 | 'Entry' => 'Text', |
||
23 | 'Level' => 'Varchar' |
||
24 | ]; |
||
25 | |||
26 | private static $summary_fields = [ |
||
27 | 'Entry', |
||
28 | 'Created', |
||
29 | 'Level' |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * Whether the cron functionality should run. This does not affect use as a BuildTask. |
||
34 | * Note: you need to configure silverstripe/crontask yourself. |
||
35 | * |
||
36 | * @config |
||
37 | * @var bool |
||
38 | */ |
||
39 | private static $cron_enabled = true; |
||
40 | |||
41 | /** |
||
42 | * How often the cron should run (default: 4am daily) |
||
43 | * |
||
44 | * @config |
||
45 | * @var string |
||
46 | */ |
||
47 | private static $cron_schedule = '0 4 * * *'; |
||
48 | |||
49 | /** |
||
50 | * The maximum age in days for a LogEntry before it will be removed |
||
51 | * |
||
52 | * @config |
||
53 | * @var int |
||
54 | */ |
||
55 | private static $max_log_age = 30; |
||
56 | |||
57 | /** |
||
58 | * Which Monolog\Logger levels (numeric) to start handling from (see class for examples) |
||
59 | * |
||
60 | * @config |
||
61 | * @var integer |
||
62 | */ |
||
63 | private static $minimum_log_level = 300; |
||
64 | |||
65 | /** |
||
66 | * Permissions |
||
67 | */ |
||
68 | public function providePermissions() |
||
83 | |||
84 | /** |
||
85 | * Format the log entry as JSON |
||
86 | * |
||
87 | * {@inheritDoc} |
||
88 | */ |
||
89 | public function getCMSFields() |
||
106 | |||
107 | /** |
||
108 | * Log entries are created programmatically, they should never be created manually |
||
109 | * |
||
110 | * {@inheritDoc} |
||
111 | */ |
||
112 | public function canCreate($member = null, $context = []) |
||
116 | |||
117 | /** |
||
118 | * We should never edit log entries |
||
119 | * |
||
120 | * {@inheritDoc} |
||
121 | */ |
||
122 | public function canEdit($member = null) |
||
126 | |||
127 | public function canDelete($member = null) |
||
131 | |||
132 | public function canView($member = null) |
||
136 | } |
||
137 |