Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| EnvironmentProcessor | |
0.00% |
0 / 4 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| getStackId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getStackType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getStackName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getStackHostType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2018 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\oatbox\log\logger\processor; |
| 23 | |
| 24 | /** |
| 25 | * Processor to add the environment details to the log. |
| 26 | * |
| 27 | * @package oat\oatbox\log\logger\processor |
| 28 | */ |
| 29 | class EnvironmentProcessor extends EnvironmentProcessorAbstract |
| 30 | { |
| 31 | /** |
| 32 | * Environment variable name for stack identifier. |
| 33 | */ |
| 34 | public const ENV_STACK_ID = 'STACK_ID'; |
| 35 | |
| 36 | /** |
| 37 | * Environment variable name for stack name. |
| 38 | */ |
| 39 | public const ENV_STACK_NAME = 'STACK_NAME'; |
| 40 | |
| 41 | /** |
| 42 | * Environment variable name for stack host type. |
| 43 | */ |
| 44 | public const ENV_STACK_HOST_TYPE = 'HOST_TYPE'; |
| 45 | |
| 46 | /** |
| 47 | * Default stack type value. |
| 48 | */ |
| 49 | public const DEFAULT_STACK_TYPE = 'tao'; |
| 50 | |
| 51 | /** |
| 52 | * @inheritdoc |
| 53 | */ |
| 54 | protected function getStackId() |
| 55 | { |
| 56 | return (string)getenv(static::ENV_STACK_ID); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @inheritdoc |
| 61 | */ |
| 62 | protected function getStackType() |
| 63 | { |
| 64 | return static::DEFAULT_STACK_TYPE; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @inheritdoc |
| 69 | */ |
| 70 | protected function getStackName() |
| 71 | { |
| 72 | return (string)getenv(static::ENV_STACK_NAME); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @inheritdoc |
| 77 | */ |
| 78 | protected function getStackHostType() |
| 79 | { |
| 80 | return (string)getenv(static::ENV_STACK_HOST_TYPE); |
| 81 | } |
| 82 | } |