/**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes(array(__DIR__ . '/../../config/config.php' => config_path('epilog.php')));
     $logger = \Log::getMonolog();
     // Additional info in message
     $logger->pushProcessor(function ($record) {
         $info = '';
         if (\Auth::check()) {
             $info .= 'User #' . \Auth::user()->id . ' (' . \Auth::user()->email . ') - ';
         }
         if (isset($_SERVER['REMOTE_ADDR'])) {
             $info .= 'IP: ' . $_SERVER['REMOTE_ADDR'];
         }
         if (isset($_SERVER['REQUEST_URI'])) {
             $info .= "\n" . $_SERVER['REQUEST_METHOD'] . " " . url($_SERVER['REQUEST_URI']);
         }
         if (isset($_SERVER['HTTP_REFERER'])) {
             $info .= "\nReferer: " . $_SERVER['HTTP_REFERER'];
         }
         if ($info) {
             $info = "\n---\n{$info}\n---";
             if (strpos($record['message'], "\n")) {
                 $record['message'] = preg_replace("/\n/", $info . "\n", $record['message'], 1);
             } else {
                 $record['message'] .= $info . "\n";
             }
         }
         return $record;
     });
     // Slack notification
     if (app()->environment(config('epilog.slack.env'))) {
         $slackHandler = new \Monolog\Handler\SlackHandler(config('epilog.slack.token'), config('epilog.slack.channel'), config('epilog.slack.username'), true, ':skull:', \Monolog\Logger::ERROR, true, true, true);
         $logger->pushHandler($slackHandler);
     }
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     /* Set the Language Based on Agent Browser */
     $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     $lang = substr($languages[0], 0, 2);
     App::setLocale($lang);
     /* Load Assets */
     Asset::add('bootstraptheme', 'assets/css/bootstrap-spacelab.css');
     Asset::add('bootstrapresponsive', 'assets/css/bootstrap-responsive.css');
     Asset::add('charisma', 'assets/css/charisma-app.css');
     Asset::add('uniform', 'assets/css/uniform.default.css');
     Asset::add('elfinder', 'assets/css/elfinder.min.css');
     Asset::add('opaicons', 'assets/css/opa-icons.css');
     Asset::add('famfam', 'assets/css/famfam.css');
     Asset::add('jqueryloadermin', 'assets/css/jquery.loader-min.css');
     Asset::add('reportula', 'assets/css/reportula.css');
     Asset::add('jquery', 'assets/js/jquery-2.0.3.min.js');
     Asset::add('datatables', 'assets/js/jquery.dataTables.min.js', 'jquery');
     Asset::add('jqueryloader', 'assets/js/jquery.loader-min.js', 'jquery');
     Asset::add('main', 'assets/js/main.js', 'TableTools');
     Asset::add('modal', 'assets/js/bootstrap-modal.js', 'jquery');
     /* Get Monolog instance from Laravel */
     $monolog = Log::getMonolog();
     /* Add the FirePHP handler */
     $monolog->pushHandler(new \Monolog\Handler\FirePHPHandler());
     /* Resolve Database Names Myslq and Postgres */
     if (Config::get('database.default') == 'mysql') {
         $this->tables = array('job' => 'Job', 'client' => 'Client', 'files' => 'Files', 'media' => 'Media', 'pool' => 'Pool', 'path' => 'Path', 'filename' => 'Filename', 'file' => 'File', 'jobfiles' => 'JobFiles', 'jobmedia' => 'JobMedia');
     } else {
         $this->tables = array('job' => 'job', 'client' => 'client', 'files' => 'files', 'media' => 'media', 'pool' => 'pool', 'path' => 'path', 'filename' => 'filename', 'file' => 'file', 'jobfiles' => 'jobfiles', 'jobmedia' => 'jobmedia');
     }
 }
 /**
  * Register propel runtime configuration.
  *
  * @return void
  */
 protected function registerRuntimeConfiguration()
 {
     $propel_conf = $this->app->config['propel.propel'];
     if (!isset($propel_conf['runtime']['connections'])) {
         throw new \InvalidArgumentException('Unable to guess Propel runtime config file. Please, initialize the "propel.runtime" parameter.');
     }
     /** @var $serviceContainer \Propel\Runtime\ServiceContainer\StandardServiceContainer */
     $serviceContainer = Propel::getServiceContainer();
     $serviceContainer->closeConnections();
     $serviceContainer->checkVersion('2.0.0-dev');
     $runtime_conf = $propel_conf['runtime'];
     // set connections
     foreach ($runtime_conf['connections'] as $connection_name) {
         $config = $propel_conf['database']['connections'][$connection_name];
         $serviceContainer->setAdapterClass($connection_name, $config['adapter']);
         $manager = new ConnectionManagerSingle();
         $manager->setConfiguration($config + [$propel_conf['paths']]);
         $manager->setName($connection_name);
         $serviceContainer->setConnectionManager($connection_name, $manager);
     }
     $serviceContainer->setDefaultDatasource($runtime_conf['defaultConnection']);
     // set loggers
     $has_default_logger = false;
     if (isset($runtime_conf['log'])) {
         $has_default_logger = array_key_exists('defaultLogger', $runtime_conf['log']);
         foreach ($runtime_conf['log'] as $logger_name => $logger_conf) {
             $serviceContainer->setLoggerConfiguration($logger_name, $logger_conf);
         }
     }
     if (!$has_default_logger) {
         $serviceContainer->setLogger('defaultLogger', \Log::getMonolog());
     }
     Propel::setServiceContainer($serviceContainer);
 }
Ejemplo n.º 4
0
 protected static function getMonolog()
 {
     // Use facade if it is available
     if (class_exists('Log')) {
         return \Log::getMonolog();
     }
     // otherwise create a new instance
     return parent::getMonolog();
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $app = $this->app;
     // Listen to log messages.
     $app['log']->listen(function () use($app) {
         $logger = \Log::getMonolog();
         $logger->pushHandler($app['loggly.handler']);
     });
 }
Ejemplo n.º 6
0
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('Psr\\Log\\LoggerInterface', function () {
         return \Log::getMonolog();
     });
     $this->app->bind('App\\Basket\\Notifications\\LocationNotificationService', 'App\\Basket\\Notifications\\EmailLocationNotificationService');
     $this->app->bind('PayBreak\\Sdk\\ApiClient\\ApiClientFactoryInterface', 'App\\Gateways\\ApiClientFactory');
     $this->app->when('PayBreak\\Sdk\\Gateways\\SettlementCsvGateway')->needs('PayBreak\\Sdk\\ApiClient\\ApiClientFactoryInterface')->give('App\\Gateways\\ApiCsvClientFactory');
 }
Ejemplo n.º 7
0
 public function register()
 {
     $this->app->singleton('groundsix.profiler', function () {
         return new \GroundSix\Component\StatsProfiler();
     });
     $monolog = \Log::getMonolog();
     $this->app['groundsix.profiler']->setLogger($monolog);
     $this->app['groundsix.profiler']->push("Provider registered");
 }
Ejemplo n.º 8
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $logger = \Log::getMonolog();
     try {
         $service = LogKeeperServiceFactory::buildFromLaravelConfig();
         $logger = $service->getLogger();
         $service->work();
     } catch (Exception $e) {
         $logger->error("Something went wrong: {$e->getMessage()}");
     }
 }
Ejemplo n.º 9
0
*/
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds', app_path() . '/util', app_path() . '/services', app_path() . '/builders'));
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
| is built on top of the wonderful Monolog library. By default we will
| build a basic log file setup which creates a single file for logs.
|
*/
$logFile = 'atlas.log';
Log::useDailyFiles(storage_path() . '/logs/' . $logFile, 7, Config::get('app.log-level'));
if (App::environment() == 'local') {
    $monolog = Log::getMonolog();
    $monolog->pushHandler(new \Monolog\Handler\ChromePHPHandler());
}
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
Ejemplo n.º 10
0
 /**
  * @author EA
  * @param string $token
  * @return ProviderApiClient
  */
 public function makeApiClient($token)
 {
     return ProviderCsvApiClient::make(config('basket.providerUrl'), $token, \Log::getMonolog());
 }
Ejemplo n.º 11
0
 public function __construct()
 {
     parent::__construct();
     $this->log = \Log::getMonolog();
 }
Ejemplo n.º 12
0
| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
| is built on top of the wonderful Monolog library. By default we will
| build a basic log file setup which creates a single file for logs.
|
*/
Log::useFiles(storage_path() . '/logs/laravel.log');
Log::getMonolog()->pushHandler(new \Monolog\Handler\StreamHandler('php://stderr', \Monolog\Logger::WARNING));
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
});
Ejemplo n.º 13
0
 private function bootLoggly()
 {
     $logglyHandler = new LogglyHandler(config('services.loggly.token'));
     $logglyHandler->setFormatter(new LogglyFormatter());
     \Log::getMonolog()->pushHandler($logglyHandler);
 }
Ejemplo n.º 14
0
ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds'));
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
| is built on top of the wonderful Monolog library. By default we will
| build a basic log file setup which creates a single file for logs.
|
*/
Log::useFiles(storage_path() . '/logs/laravel.log');
if (Config::get('app.logglykey') && Config::get('app.logglytag')) {
    $handler = new \Monolog\Handler\LogglyHandler(Config::get('app.logglykey'), \Monolog\Logger::DEBUG);
    $handler->setTag(Config::get('app.logglytag'));
    $logger = Log::getMonolog();
    $logger->pushHandler($handler);
}
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
/** @noinspection PhpUnusedParameterInspection */
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/../config/propel.php' => config_path('propel.php')]);
     if (!$this->app->config['propel.propel.runtime.connections']) {
         throw new \InvalidArgumentException('Unable to guess Propel runtime config file. Please, initialize the "propel.runtime" parameter.');
     }
     // load pregenerated config
     if (file_exists(app_path() . '/propel/config.php')) {
         Propel::init(app_path() . '/propel/config.php');
         return;
     }
     // runtime configuration
     /** @var \Propel\Runtime\ServiceContainer\StandardServiceContainer */
     $serviceContainer = \Propel\Runtime\Propel::getServiceContainer();
     $serviceContainer->closeConnections();
     $serviceContainer->checkVersion('2.0.0-dev');
     $propel_conf = $this->app->config['propel.propel'];
     $runtime_conf = $propel_conf['runtime'];
     // set connections
     foreach ($runtime_conf['connections'] as $connection_name) {
         $config = $propel_conf['database']['connections'][$connection_name];
         if (!isset($config['classname'])) {
             if ($this->app->config['app.debug']) {
                 $config['classname'] = '\\Propel\\Runtime\\Connection\\DebugPDO';
             } else {
                 $config['classname'] = '\\Propel\\Runtime\\Connection\\ConnectionWrapper';
             }
         }
         $serviceContainer->setAdapterClass($connection_name, $config['adapter']);
         $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
         $manager->setConfiguration($config + [$propel_conf['paths']]);
         $manager->setName($connection_name);
         $serviceContainer->setConnectionManager($connection_name, $manager);
     }
     $serviceContainer->setDefaultDatasource($runtime_conf['defaultConnection']);
     // set loggers
     $has_default_logger = false;
     if (isset($runtime_conf['log'])) {
         foreach ($runtime_conf['log'] as $logger_name => $logger_conf) {
             $serviceContainer->setLoggerConfiguration($logger_name, $logger_conf);
             $has_default_logger |= $logger_name === 'defaultLogger';
         }
     }
     if (!$has_default_logger) {
         $serviceContainer->setLogger('defaultLogger', \Log::getMonolog());
     }
     Propel::setServiceContainer($serviceContainer);
     $command = false;
     if (\App::runningInConsole()) {
         $input = new ArgvInput();
         $command = $input->getFirstArgument();
     }
     // skip auth driver adding if running as CLI to avoid auth model not found
     if ('propel:model:build' !== $command && 'propel' === \Config::get('auth.driver')) {
         $query_name = \Config::get('auth.user_query', false);
         if ($query_name) {
             $query = new $query_name();
             if (!$query instanceof Criteria) {
                 throw new InvalidConfigurationException("Configuration directive «auth.user_query» must contain valid classpath of user Query. Excpected type: instanceof Propel\\Runtime\\ActiveQuery\\Criteria");
             }
         } else {
             $user_class = \Config::get('auth.model');
             $query = new $user_class();
             if (!method_exists($query, 'buildCriteria')) {
                 throw new InvalidConfigurationException("Configuration directive «auth.model» must contain valid classpath of model, which has method «buildCriteria()»");
             }
             $query = $query->buildPkeyCriteria();
             $query->clear();
         }
         \Auth::extend('propel', function (\Illuminate\Foundation\Application $app) use($query) {
             return new PropelUserProvider($query, $app->make('hash'));
         });
     }
 }
 public function boot(Connection $db)
 {
     $this->publishes([__DIR__ . '/config/log.php' => config_path('log.php')], 'zedisdog/mysqlHandler');
     $mysqlHandler = new MySQLHandler($db->getPdo(), config('log.table', 'log'), [], Logger::DEBUG);
     \Log::getMonolog()->pushHandler($mysqlHandler);
 }
Ejemplo n.º 17
0
 /**
  * Factory - Create Monolog instance which has a Slack handler.
  */
 protected function createLogger()
 {
     $logger = \Log::getMonolog();
     $logger->pushHandler((new \Monolog\Handler\SlackHandler(env('SLACK_TOKEN'), '#l5essential', 'aws-demo'))->setLevel(\Monolog\Logger::ERROR));
     return $this->logger = $logger;
 }
Ejemplo n.º 18
0
 /**
  * @return \Monolog\Logger
  */
 protected function getLogger()
 {
     return \Log::getMonolog();
 }
Ejemplo n.º 19
0
 /**
  * Add a log handler based on the input configuration to log job info too
  *
  * @return void
  */
 private function addLogHandler()
 {
     $log_system = \Config::get('input::joblog.system');
     if ($log_system == 'mongodb') {
         $mongo_config = \Config::get('input::joblog.databases.mongodb');
         $username = $mongo_config['username'];
         $password = $mongo_config['password'];
         $auth = [];
         if (!empty($username)) {
             $auth['username'] = $username;
             $password = $mongo_config['password'];
             if (!empty($password)) {
                 $auth['password'] = $password;
             }
         }
         $connString = 'mongodb://' . $mongo_config['host'] . ':' . $mongo_config['port'] . '/logs';
         $mongoHandler = new MongoDBHandler(new MongoClient($connString, $auth), $mongo_config['database'], $mongo_config['collection']);
         \Log::getMonolog()->pushHandler($mongoHandler);
     } elseif ($log_system == 'elasticsearch') {
         $es_config = \Config::get('input::joblog.databases.elasticsearch');
         $username = $es_config['username'];
         $pw = $es_config['password'];
         $host = $es_config['host'];
         if (!empty($username) && !empty($pw)) {
             $auth_header_val = 'Basic ' . base64_encode($username . ':' . $pw);
             $auth_header = array('Authorization' => $auth_header_val);
         }
         $config['host'] = $host;
         $config['port'] = $es_config['port'];
         $config['headers'] = $auth_header;
         $index = $es_config['index'];
         $type = $es_config['type'];
         $client = new Client($config);
         $handler = new ElasticSearchHandler($client, ['index' => $index, 'type' => $type]);
         \Log::getMonolog()->pushHandler($handler);
     }
 }
Ejemplo n.º 20
0
 public function register()
 {
     if (config('ninecells.log.useSlack', false)) {
         with(\Log::getMonolog())->pushHandler(new \Monolog\Handler\SlackHandler(config('ninecells.log.slack.token'), config('ninecells.log.slack.channel'), config('ninecells.log.slack.username'), config('ninecells.log.slack.useAttachment'), config('ninecells.log.slack.iconEmoji'), config('ninecells.log.slack.level')));
     }
 }
Ejemplo n.º 21
0
 /**
  * @param \Psr\Log\LoggerInterface|null $logger
  */
 public function __construct(LoggerInterface $logger = null)
 {
     $this->initializeLumberjack($logger ?: \Log::getMonolog());
     static::LOG_PREFIX && $this->setLumberjackPrefix(static::LOG_PREFIX);
 }
Ejemplo n.º 22
0
 public function Log()
 {
     $Monolog = Log::getMonolog();
     $Monolog->addError();
 }