public static function getFileAndMailLogger($logFile, $fileLevel, $mailTo, $mailLevel) { $monolog = new Monolog('f&mLog'); $streamHandler = new StreamHandler($logFile, $fileLevel); $mailHandler = new NativeMailerHandler($mailTo, date("Y-m-d H:i:s") . ' - e7Bot error ', "e7bot", $fileLevel, true, 300); $mailHandler->setFormatter(new LineFormatter(self::LOG_FORMAT, null, true)); $streamHandler->setFormatter(new LineFormatter(self::LOG_FORMAT, null, true)); $monolog->pushHandler($streamHandler); $monolog->pushHandler($mailHandler); ErrorHandler::register($monolog); return new Logger($monolog, $logFile); }
public static function configureEmails(Monolog $monolog, $emailAddresses, $emailSubject) { if (!empty($emailAddresses)) { $senderEmail = config('logging.email_sender_address') ?: false; if (empty($senderEmail)) { $senderEmail = 'errors@' . (empty($_SERVER['HTTP_HOST']) ? 'unknown.host' : $_SERVER['HTTP_HOST']); } $mail = new NativeMailerHandler($emailAddresses, $emailSubject, $senderEmail, config('logging.log_level', Logger::WARNING)); $mail->setFormatter(new HtmlFormatter()); $mail->pushProcessor(new WebProcessor()); $mail->pushProcessor(new IntrospectionProcessor(Logger::DEBUG)); $mail->setContentType('text/html'); $monolog->pushHandler($mail); } }
if (WP_DEBUG == false || !$nataraja) { $titulo = 'Falha em Eventos'; if (WP_DEBUG && !$nataraja) { $titulo = 'DEV - Falha em Eventos'; } require_once 'lib/MonologFormatter.class.php'; if (!file_exists(ABSPATH . '/log/')) { die('É necessário existir a pasta ' . ABSPATH . '/log/'); } $log = new Logger('name'); $mailer = new NativeMailerHandler(TGO_EVENTO_ADMIN, $titulo, TGO_EVENTO_ADMIN); $streamHandler = new StreamHandler(ABSPATH . '/log/monolog.log'); $errHandler = new ErrorHandler($log); $errHandler->registerErrorHandler(); $errHandler->registerExceptionHandler(); $mailer->setFormatter(new MonologFormatter()); $log->pushHandler($streamHandler, Logger::WARNING); $log->pushHandler($mailer, Logger::WARNING); } add_filter('wpseo_locale', 'override_og_locale'); function override_og_locale($locale) { return "pt_BR"; } // Requires iniciais include_once 'lib/Cpp.php'; include_once 'functions.php'; include_once 'Shortcodes.php'; include_once 'vendor/TiagoGouvea/DataMapper/DomainObjectAbstract.class.php'; include_once 'vendor/TiagoGouvea/DataMapper/MapperAbstract.class.php'; include_once 'vendor/TiagoGouvea/WPDataMapper/WPSimpleMapper.class.php';