|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace ErrorHeroModule; |
| 4 | + |
| 5 | +use Zend\Expressive\ZendView\HelperPluginManagerFactory; |
| 6 | +use Zend\Log; |
| 7 | +use Zend\ServiceManager\Factory\InvokableFactory; |
| 8 | + |
| 9 | +return [ |
| 10 | + |
| 11 | + 'log' => [ |
| 12 | + 'ErrorHeroModuleLogger' => [ |
| 13 | + 'writers' => [ |
| 14 | + |
| 15 | + [ |
| 16 | + 'name' => 'db', |
| 17 | + 'options' => [ |
| 18 | + 'db' => 'Zend\Db\Adapter\Adapter', |
| 19 | + 'table' => 'error_log', |
| 20 | + 'column' => [ |
| 21 | + 'timestamp' => 'date', |
| 22 | + 'priority' => 'type', |
| 23 | + 'message' => 'event', |
| 24 | + 'extra' => [ |
| 25 | + 'url' => 'url', |
| 26 | + 'file' => 'file', |
| 27 | + 'line' => 'line', |
| 28 | + 'error_type' => 'error_type', |
| 29 | + 'trace' => 'trace', |
| 30 | + 'request_data' => 'request_data', |
| 31 | + ], |
| 32 | + ], |
| 33 | + ], |
| 34 | + ], |
| 35 | + |
| 36 | + ], |
| 37 | + ], |
| 38 | + ], |
| 39 | + |
| 40 | + 'error-hero-module' => [ |
| 41 | + // it's for the enable/disable the logger functionality |
| 42 | + 'enable' => true, |
| 43 | + |
| 44 | + // default to true, if set to true, then you can see sample: |
| 45 | + // 1. /error-preview page ( ErrorHeroModule\Middleware\ErrorPreviewAction ) |
| 46 | + // 2. error-preview command ( ErrorHeroModule\Controller\ErrorPreviewConsoleAction ) via |
| 47 | + // php public/index.php error-preview |
| 48 | + // |
| 49 | + // otherwise(false), you can't see them, eg: on production env. |
| 50 | + 'enable-error-preview-page' => true, |
| 51 | + |
| 52 | + 'display-settings' => [ |
| 53 | + |
| 54 | + // excluded php errors |
| 55 | + 'exclude-php-errors' => [ |
| 56 | + E_USER_DEPRECATED |
| 57 | + ], |
| 58 | + |
| 59 | + // show or not error |
| 60 | + 'display_errors' => 0, |
| 61 | + |
| 62 | + // if enable and display_errors = 0, the page will bring layout and view |
| 63 | + 'template' => [ |
| 64 | + 'layout' => 'layout::default', |
| 65 | + 'view' => 'error-hero-module::error-default' |
| 66 | + ], |
| 67 | + |
| 68 | + // if enable and display_errors = 0, and on console env, the console will bring message |
| 69 | + 'console' => [ |
| 70 | + 'message' => 'We have encountered a problem and we can not fulfill your request. An error report has been generated and send to the support team and someone will attend to this problem urgently. Please try again later. Thank you for your patience.', |
| 71 | + ], |
| 72 | + |
| 73 | + // if enable, display_errors = 0, and request XMLHttpRequest |
| 74 | + // on this case, the "template" key will be ignored. |
| 75 | + 'ajax' => [ |
| 76 | + 'message' => <<<json |
| 77 | +{ |
| 78 | + "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", |
| 79 | + "title": "Internal Server Error", |
| 80 | + "status": 500, |
| 81 | + "detail": "We have encountered a problem and we can not fulfill your request. An error report has been generated and send to the support team and someone will attend to this problem urgently. Please try again later. Thank you for your patience." |
| 82 | +} |
| 83 | +json |
| 84 | + ], |
| 85 | + |
| 86 | + ], |
| 87 | + 'logging-settings' => [ |
| 88 | + // time range for same error, file, line, url, message to be re-logged |
| 89 | + // in seconds range, 86400 means 1 day |
| 90 | + 'same-error-log-time-range' => 86400, |
| 91 | + ], |
| 92 | + 'email-notification-settings' => [ |
| 93 | + // set to true to activate email notification on log error |
| 94 | + 'enable' => false, |
| 95 | + |
| 96 | + // Zend\Mail\Message instance registered at service manager |
| 97 | + 'mail-message' => 'YourMailMessageService', |
| 98 | + |
| 99 | + // Zend\Mail\Transport\TransportInterface instance registered at service manager |
| 100 | + 'mail-transport' => 'YourMailTransportService', |
| 101 | + |
| 102 | + // email sender |
| 103 | + 'email-from' => 'Sender Name <sender@host.com>', |
| 104 | + |
| 105 | + 'email-to-send' => [ |
| 106 | + 'developer1@foo.com', |
| 107 | + 'developer2@foo.com', |
| 108 | + ], |
| 109 | + ], |
| 110 | + ], |
| 111 | + |
| 112 | + 'dependencies' => [ |
| 113 | + 'abstract_factories' => [ |
| 114 | + Log\LoggerAbstractServiceFactory::class, |
| 115 | + ], |
| 116 | + 'factories' => [ |
| 117 | + Middleware\Expressive::class => Middleware\ExpressiveFactory::class, |
| 118 | + ErrorHeroModule\Middleware\Routed\Preview\ErrorPreviewAction::class => InvokableFactory::class, |
| 119 | + |
| 120 | + Handler\Logging::class => Handler\LoggingFactory::class, |
| 121 | + 'ViewHelperManager' => HelperPluginManagerFactory::class, |
| 122 | + ], |
| 123 | + ], |
| 124 | + |
| 125 | + 'templates' =>[ |
| 126 | + 'paths' => [ |
| 127 | + 'error-hero-module' => [ |
| 128 | + realpath( dirname(dirname(__DIR__) ) . '/vendor/samsonasik/error-hero-module/view/error-hero-module' ), |
| 129 | + ], |
| 130 | + ], |
| 131 | + ], |
| 132 | + |
| 133 | + 'middleware_pipeline' => [ |
| 134 | + 'always' => [ |
| 135 | + 'middleware' => [ |
| 136 | + Middleware\Expressive::class |
| 137 | + ], |
| 138 | + 'priority' => PHP_INT_MAX, |
| 139 | + ], |
| 140 | + ], |
| 141 | + |
| 142 | +]; |
0 commit comments