Пример #1
0
 /**
  * LogService constructor.
  *
  * @param $monolog
  */
 public function __construct()
 {
     $this->monolog = Log::getMonolog();
     $this->path = storage_path() . '/logs/';
     $this->type = Logger::INFO;
     $this->file = "laravel.log";
 }
 /**
  * Send logs from the given level to Pushbullet.
  *
  * @return void
  */
 public function boot()
 {
     parent::boot();
     if (in_array(config('app.env'), (array) config('services.monobullet.env', config('app.env')))) {
         $monolog = Log::getMonolog();
         $monolog->pushHandler(new PushbulletHandler(config('services.monobullet.token'), config('services.monobullet.recipients'), config('services.monobullet.level', Logger::INFO), config('services.monobullet.propagate', true)));
     }
 }
Пример #3
0
 /**
  * Define environment setup.
  *
  * @param  Illuminate\Foundation\Application $app
  * @return void
  */
 protected function getEnvironmentSetUp($app)
 {
     // reset base path to point to our package's src directory
     $app['path.base'] = __DIR__ . '/../../';
     $app['config']->set('app.debug', false);
     // Here we disable any log output to the console, which makes reading any test
     // errors/information easier to read and understand during test runs.
     $monolog = Log::getMonolog();
     $monolog->pushHandler(new NullHandler());
     // Necessary for future checks
     Config::set('shift.languages', ['en_GB' => 'English (Great Britain)']);
 }
 protected function bootWhenLocal()
 {
     //开发环境
     if (!$this->app->isLocal()) {
         return;
     }
     //日志
     $logger = Log::getMonolog();
     $logger->pushHandler(new BrowserConsoleHandler());
     //DB事件
     DB::listen(function ($query) {
         Log::info('sql :' . $query->sql, ['binding' => $query->bindings, 'time' => $query->time]);
     });
 }
Пример #5
0
 /**
  * Boot the service provider.
  *
  * @return void
  *
  * @author Wuhsien Yu <*****@*****.**>
  *
  * @since  2016/03/10
  */
 public function boot()
 {
     $monolog = Log::getMonolog();
     $LogLevel = Logger::toMonologLevel(self::getLevel());
     foreach (Logger::getLevels() as $level) {
         if ($LogLevel <= $level) {
             $logHandler = new StreamHandler(self::getPath($level), $level, false);
             $logHandler->setFormatter(self::getFormat());
         } else {
             $logHandler = new NullHandler($level);
         }
         $monolog->pushHandler($logHandler);
     }
     $this->publishes([__DIR__ . '/../config/log.php' => config_path('log.php')]);
 }
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('tevo', function () {
         // Setup Logger
         $log = Log::getMonolog();
         $log->pushHandler(new RotatingFileHandler(storage_path('logs/tevo-api-client-log.txt'), 0, constant('\\Monolog\\Logger::' . env('TEVO_API_CLIENT_LOG_LEVEL', 'INFO'))));
         if (env('TEVO_API_CLIENT_LOG_LEVEL') === 'DEBUG') {
             $subscriberLogLevel = 'DEBUG';
         } else {
             $subscriberLogLevel = 'CLF';
         }
         $logSubscriber = new LogSubscriber($log, constant('\\GuzzleHttp\\Subscriber\\Log\\Formatter::' . $subscriberLogLevel));
         $apiClient = new Client(config('ticketevolution'));
         $apiClient->getEmitter()->attach($logSubscriber);
         return $apiClient;
     });
     $this->app->alias('Tevo', self::class);
 }
Пример #7
0
 public function getLogKayitlari()
 {
     $monolog = Log::getMonolog();
     return view('yonetim.logkayitlari', compact('monolog'));
 }
Пример #8
0
 /**
  * @return LoggerInterface
  */
 public function getLogger()
 {
     return $this->logger ?: ($this->logger = Log::getMonolog());
 }
Пример #9
0
 /**
  * Get the log plugin.
  *
  * @return LogPlugin
  */
 public static function getLogPlugin()
 {
     $adapter = new MonologLogAdapter(Log::getMonolog());
     $format = "[{ts}] \"{method} {resource} {protocol}/{version}\" {code} {phrase} time:{total_time} kinveyRID:{res_header_x-kinvey-request-id} request:{req_body}";
     $formatter = new MessageFormatter($format);
     return new LogPlugin($adapter, $formatter);
 }
Пример #10
0
 /**
  * Constructor
  *
  * @param Application $app
  */
 public function __construct($app = null)
 {
     $this->app = $app;
     $this->initializeLumberjack(Log::getMonolog());
     $this->boot();
 }