/**
  * @param DomainListener $listener
  * @return mixed
  */
 public function execute(DomainListener $listener)
 {
     $user = $this->auth->user();
     $domains = $this->repository->listOfDomains($user->id);
     $this->log->info('Show Domains');
     return $listener->view('domains.index', compact('domains'));
 }
 /**
  * setting up listener
  *
  * @param Dispatcher $events
  * @param Writer $log
  */
 private function setupListener(Dispatcher $events, Writer $log)
 {
     $environments = config('slow-query-logger.environments', []);
     if (!$this->app->environment($environments)) {
         return;
     }
     $events->listen(QueryExecuted::class, function (QueryExecuted $queryExecuted) use($log) {
         $sql = $queryExecuted->sql;
         $bindings = $queryExecuted->bindings;
         $time = $queryExecuted->time;
         $logSqlQueriesSlowerThan = config('slow-query-logger.time-to-log');
         if ($logSqlQueriesSlowerThan < 0 || $time < $logSqlQueriesSlowerThan) {
             return;
         }
         $level = config('slow-query-logger.log-level', 'debug');
         try {
             foreach ($bindings as $val) {
                 $sql = preg_replace('/\\?/', "'{$val}'", $sql, 1);
             }
             $log->log($level, $time . '  ' . $sql);
         } catch (\Exception $e) {
             //  be quiet on error
         }
     });
 }
Example #3
0
 /**
  * @param $domainId
  * @param DomainListener $listener
  * @return mixed
  */
 public function execute($domainId, DomainListener $listener)
 {
     $domain = $this->repository->getDomainById($domainId);
     $sshKey = $this->getPublicKey();
     $this->log->info('Show Domain id ' . $domainId, $domain->toArray());
     return $listener->view('domains.show', compact('domain', 'sshKey'));
 }
 /**
  * Execute the required command against the command handler.
  *
  * @param Command $command
  * @return mixed
  */
 public function execute(Command $command)
 {
     $handler = $this->commandTranslator->getCommandHandler($command);
     $commandName = $this->getCommandName($command);
     $this->log->info("New command [{$commandName}]", get_object_vars($command));
     return $this->app->make($handler)->handle($command);
 }
Example #5
0
 /**
  * Stores The SupervisorD configuration
  *
  * @param $worker
  */
 private function storeSupervisordConfig($worker)
 {
     $domain = Domain::findOrFail($worker->domain_id);
     $file = view('configuration.supervisord', compact('worker', 'domain'))->render();
     File::put(Config::get('settings.supervisord_location') . '/worker-' . $worker->id . '.log', $file);
     $this->log->info('Supervisord Config created');
 }
Example #6
0
 /**
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->event->fire($eventName, $event);
         $this->log->info("{$eventName} was fired.");
     }
 }
 /**
  * Dispatches the array of events, firing off the appropriate event name for each and logging the event fired.
  *
  * @param array $events
  */
 public function dispatch(array $events)
 {
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->log->info("New event [{$eventName}]", get_object_vars($event));
         $this->event->fire($eventName, $event);
     }
 }
 /**
  * @return mixed
  */
 public function api()
 {
     $args = func_get_args();
     if (self::$laravelDebug === true) {
         $this->laravelLog->info('Facebook Api Call: ' . print_r($args, 1));
     }
     return call_user_func_array("parent::api", $args);
 }
 /**
  * Custom Monolog handler that for Logentries.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Log\Writer  $log
  * @return void
  */
 protected function configureHandlers(Application $app, Writer $log)
 {
     $logger = $log->getMonolog();
     $logfile_handler = new StreamHandler(storage_path() . '/logs/laravel.log');
     $logger->pushHandler($logfile_handler);
     $logger->pushProcessor(new \Monolog\Processor\MemoryUsageProcessor());
     $logger->pushProcessor(new \Monolog\Processor\MemoryPeakUsageProcessor());
     $logger->pushProcessor(new \Monolog\Processor\WebProcessor());
 }
 public function execute($domainId, $envData, EnvironmentsListener $listener)
 {
     if (empty($envData['environment'])) {
         $envData['environment'] = 'production';
     }
     $environment = $this->repository->addEnvironment($domainId, $envData);
     $this->log->info('Environment variable added', $environment->toArray());
     return $listener->environmentRedirect($environment);
 }
 /**
  * Configures log writer for logging to files separately from the application.
  *
  * @param Writer $writer
  */
 protected function configureSeparateWriter(Writer $writer)
 {
     $path = 'logs/' . ltrim($this->getCore()->config('log.file', 'cms'), '/');
     if ($this->getCore()->config('log.daily')) {
         $writer->useDailyFiles(storage_path($path), (int) $this->getCore()->config('log.max_files'));
     }
     foreach ($writer->getMonolog()->getHandlers() as $handler) {
         $handler->setLevel($this->getCore()->config('log.threshold'));
     }
 }
 /**
  * Configure the Monolog handlers for the application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Log\Writer  $log
  * @return void
  */
 protected function configureHandlers(Application $app, Writer $log)
 {
     // Stream handlers
     $logPath = $app->storagePath() . '/logs/app.log';
     $logLevel = Monolog::INFO;
     $logStreamHandler = new StreamHandler($logPath, $logLevel);
     // push handlers
     $logger = $log->getMonolog();
     $logger->pushHandler($logStreamHandler);
 }
Example #13
0
 /**
  * Release the events on the event stack.
  *
  * @param array $events
  */
 public function dispatch(array $events)
 {
     // For every Event's on the event array
     // It will get the event name from the object Namespace the fire that event
     // Also will write that in the log file as an information log
     foreach ($events as $event) {
         $eventName = $this->getEventName($event);
         $this->event->fire($eventName, $event);
         $this->log->info("{$eventName} was fired");
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $correlationalId = $request->attributes->get(CorrelationalId::HEADER);
     $this->logger->getMonolog()->pushProcessor(function ($record) use($correlationalId) {
         $record['extra'][self::LOG_KEY] = $correlationalId;
         return $record;
     });
     /** @var Response $response */
     $response = $next($request);
     return $response;
 }
Example #15
0
 /**
  * Configure the Monolog handlers for the application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Log\Writer  $log
  * @return void
  */
 protected function configureSingleHandler(Application $app, Writer $log)
 {
     $syslogHandler = new SyslogHandler(env('LOG_PREFIX', 'BasketLog'), LOG_USER, LOG_NOTICE);
     $logger = $log->getMonolog();
     if (env('LOG_SYSLOG', false)) {
         $logger->pushHandler($syslogHandler);
     }
     if (env('LOG_FILE', false)) {
         $streamHandler = new StreamHandler(storage_path('logs/laravel.log'), LOG_NOTICE);
         $logger->pushHandler($streamHandler);
     }
 }
 /**
  * Dispatch the events
  *
  * @param array $events
  * @param bool  $log
  */
 public function dispatch(array $events, $log = false)
 {
     foreach ($events as $event) {
         // Get the name of the event
         $eventName = $this->getEventName($event);
         // Fire the event
         $this->event->fire($eventName, [$event]);
         if ($log) {
             // Log that the event was fired
             $this->logger->info("Event [{$eventName}] was fired.");
         }
     }
 }
Example #17
0
 function loger($level, $file, $line, $string, $ar = NULL)
 {
     // если системный level ниже notice, то при включеном KINT_DUMP, ставим уровень notice
     if ($GLOBALS['KINT_DUMP'] && $this->agiconfig['verbosity_level'] < 2) {
         $this->agiconfig['verbosity_level'] = 2;
     }
     if ($this->agiconfig['verbosity_level'] < $level) {
         return;
     }
     if ($GLOBALS['KINT_DUMP']) {
         ~d("{$level} | {$file} | {$line}");
         if (!is_null($string)) {
             d($string);
         }
         if (!is_null($ar)) {
             d($ar);
         }
         return;
     }
     if (!is_null($string)) {
         $this->agi->verbose($string);
     }
     if (!is_null($ar)) {
         $this->agi->verbose($ar);
     }
     if ((int) $this->agiconfig['logging_write_file'] === 1) {
         $logger = new Writer(new Logger('local'));
         $logger->useFiles($this->config['logs_patch']);
         if (!is_null($ar)) {
             $string .= "\n";
             $string .= var_export($string, true);
         }
         switch ($level) {
             case 'error':
                 $logger->error("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'warning':
                 $logger->warning("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'notice':
                 $logger->notice("[" . $this->uniqueid . "] [{$file}] [{$line}]: -- {$string}");
                 break;
             case 'info':
                 $logger->info("[" . $this->uniqueid . "] [{$file}] [{$line}]:  {$string}");
                 break;
             default:
                 $logger->debug("[" . $this->uniqueid . "] [{$file}] [{$line}]: {$string}");
                 break;
         }
     }
 }
 /**
  * Bootstrap the given application.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 public function bootstrap(Application $app)
 {
     $logger = new Writer(new Monolog($app->environment()), $app['events']);
     // Daily files are better for production stuff
     $logger->useDailyFiles(storage_path('/logs/laravel.log'));
     $app->instance('log', $logger);
     // Next we will bind the a Closure to resolve the PSR logger implementation
     // as this will grant us the ability to be interoperable with many other
     // libraries which are able to utilize the PSR standardized interface.
     $app->bind('Psr\\Log\\LoggerInterface', function ($app) {
         return $app['log']->getMonolog();
     });
     $app->bind('Illuminate\\Contracts\\Logging\\Log', function ($app) {
         return $app['log'];
     });
 }
Example #19
0
 /**
  * Attempt to instantiate the filter if it exists and has not been ignored.
  *
  * @return null|\Assetic\Filter\FilterInterface
  */
 public function getInstance()
 {
     if (!($class = $this->getClassName())) {
         $this->log->error(sprintf('"%s" will not be applied to asset "%s" due to an invalid filter name.', $this->filter, $this->resource->getRelativePath()));
     }
     if ($this->ignored or is_null($class) or !$this->processRequirements()) {
         return;
     }
     // If the class returned is already implements Assetic\Filter\FilterInterface then
     // we can set the instance directly and not worry about using reflection.
     if ($class instanceof FilterInterface) {
         $instance = $class;
     } else {
         $reflection = new ReflectionClass($class);
         // If no constructor is available on the filters class then we'll instantiate
         // the filter without passing in any arguments.
         if (!$reflection->getConstructor()) {
             $instance = $reflection->newInstance();
         } else {
             $instance = $reflection->newInstanceArgs($this->arguments);
         }
     }
     // Spin through each of the before filtering callbacks and fire each one. We'll
     // pass in an instance of the filter to the callback.
     foreach ($this->before as $callback) {
         if (is_callable($callback)) {
             call_user_func($callback, $instance);
         }
     }
     return $instance;
 }
 /**
  * Handles authenticating that a user/character is still valid.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function postAuthorized()
 {
     // Get the neccessary headers from the request.
     $service = $this->request->header('service', false);
     $username = $this->request->header('username', '');
     $character = $this->request->header('character', '');
     $this->log->info('A service is attempting to validate a user.', ['username' => $username, 'character' => $character, 'service' => $service]);
     // Verify that the external service exists in the configuration.
     if (!$service || !$this->config->get("addon.auth.{$service}")) {
         $this->log->info(self::ERROR_INVALID_EXTERNAL_SERVICE, ['service' => $service]);
         return $this->failure(self::ERRNO_INVALID_EXTERNAL_SERVICE, self::ERROR_INVALID_EXTERNAL_SERVICE);
     }
     // Check the cache first so the api isn't hammered too badly.
     $key = 'auth:session:' . sha1("{$service}:{$username}");
     if ($this->cache->has($key)) {
         $this->log->info('Returning the cached authorization result.');
         return $this->cache->get($key);
     }
     // Attempt to find the requested user.
     $identifier = filter_var($username, FILTER_VALIDATE_EMAIL) ? 'email' : 'name';
     $user = $this->users->where($identifier, $username)->first() ?: false;
     if (!$user) {
         $this->log->info(self::ERROR_USER_NOT_FOUND);
         return $this->failure(self::ERRNO_USER_NOT_FOUND, self::ERROR_USER_NOT_FOUND);
     }
     // Get and cache the response for 15 minutes.
     $response = $this->getLoginResult($user, $service, $character);
     $this->cache->put($key, $response, $this->carbon->now()->addMinutes(15));
     return $response;
 }
Example #21
0
 public function useDailyFiles($path, $days = 0, $level = 'debug')
 {
     if (Config::get('app.sae')) {
         return $this->useSaeLog($level);
     }
     parent::useDailyFiles($path, $days, $level);
 }
Example #22
0
 /**
  * construct function
  * @param string $logfile filename
  */
 public function __construct($logfile)
 {
     if (empty($logfile)) {
         throw new \Exception("you must set log file name!", 1);
     }
     parent::__construct(new MonologLogger('Slog'));
     $this->useDailyFiles(storage_path('logs') . '/' . $logfile);
 }
Example #23
0
 /**
  * Write a message to Monolog.
  *
  * @param  string $level
  * @param  string $message
  * @param  array  $context
  * @return void
  */
 protected function writeLog($level, $message, $context)
 {
     if ($message instanceof Exception) {
         // Set context exception using exception
         $context = array_merge($context, ['exception' => $message]);
         $message = $message->getMessage();
     }
     parent::writeLog($level, $message, $context);
 }
Example #24
0
 /**
  * Write a message to Monolog.
  *
  * @param  string $level
  * @param  string $message
  * @param  array  $context
  * @return void
  */
 protected function writeLog($level, $message, $context)
 {
     if (is_a($message, 'Exception')) {
         // Set context exception using exception
         $context = array_merge($context, ['exception' => $message]);
         $message = $message->getMessage();
     }
     $context = array_merge(['logger' => 'laravel-raven'], $context);
     parent::writeLog($level, $message, $context);
 }
 public function sysmessage(Request $request, Crypt $crypt)
 {
     $logger = new Writer(new Logger("output"));
     $logger->useFiles('php://stdout');
     $raw = $GLOBALS['HTTP_RAW_POST_DATA'];
     $logger->info('raw post:');
     $logger->info(var_export($raw, true));
     $data = $this->process($raw);
     $logger->info(var_export($data, true));
     // $errCode = $crypt->decryptMsg($raw->ComponentVerifyTicket, $raw->CreateTime, $nonce, $from_xml, $msg);
     echo 'success';
     return;
     /*
     	if ($errCode == 0) {
     		$logger->info('after decrypt:');
     		$logger->info(var_export($msg, true));
     	} else {
     		$logger->info('Err: '.$errCode);
     	}
     */
     echo 'success';
 }
Example #26
0
 /**
  * Logs that a message was sent.
  *
  * @param $message
  */
 protected function logMessage($message)
 {
     $numbers = implode(" , ", $message->getTo());
     $message = $message->getText();
     //dump($message);
     $mode = "fake";
     $delivered = $this->delivered();
     if (!$this->isPretending()) {
         $mode = 'actual';
         $delivered = $this->driver->delivered();
         //dump($delivered);
     }
     $delivered = $delivered ? 'SUCCESS' : 'FAILED';
     $this->logger->info("#MODE: {$mode}   #DELIVERED: {$delivered}  #MESSAGE: {$message}  #NUMBER: {$numbers} ");
 }
Example #27
0
 /**
  * Set the event dispatcher instance.
  *
  * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
  * @return void 
  * @static 
  */
 public static function setEventDispatcher($dispatcher)
 {
     \Illuminate\Log\Writer::setEventDispatcher($dispatcher);
 }
 /**
  * Log that a message was sent.
  *
  * @param  \Swift_Message  $message
  * @return void
  */
 protected function logMessage($message)
 {
     $emails = implode(', ', array_keys((array) $message->getTo()));
     $this->logger->info("Pretending to mail message to: {$emails}");
 }
Example #29
0
 /**
  * Configure the Monolog handlers for the application.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app        	
  * @param \Illuminate\Log\Writer $log        	
  * @return void
  */
 protected function configureErrorlogHandler(Application $app, Writer $log)
 {
     $log->useErrorLog();
 }
Example #30
0
 /**
  * Dynamically pass log calls into the writer.
  *
  * @param mixed  (level, param, param)
  * @return mixed 
  * @static 
  */
 public static function write()
 {
     return \Illuminate\Log\Writer::write();
 }