添加打印机端口监视器错误
The pursuit of building an error-free application continues. But in the meanwhile, we need to monitor our application’s errors and take action quickly. Many companies have tried to solve this problem, and one of the best on the market right now is Bugsnag.
对构建无错误应用程序的追求仍在继续。 但是与此同时,我们需要监视应用程序的错误并Swift采取措施。 许多公司都试图解决这个问题,而Bugsnag是目前市场上最好的公司之一 。
They focus on the problem of providing a bug notification system that makes sense of errors and helps you take action in various ways. In this article, we’re going to discover Bugsnag and integrate it into an existing Laravel application. You can clone the demo app from Github to follow along.
他们专注于提供一个错误通知系统的问题,该系统可以识别错误并帮助您采取各种措施。 在本文中,我们将发现Bugsnag并将其集成到现有的Laravel应用程序中。 您可以从Github克隆演示应用程序以进行后续操作。
项目设置 (Project Setup)
You can follow the instructions below to set up the demo application (it is assumed you have a working PHP environment like this one).
您可以按照下面的说明来设置演示应用程序(假定您具有像这样的工作PHP环境)。
// clone the repo
git clone git@github.com:Whyounes/bugsnag_demo.git
cd bugsnag_demo
// update dependencies
composer update
// migrate and seed the database
php artisan migrate && php artisan db:seed
在BugSnag上创建帐户 (Creating an Account on BugSnag)
Before starting to use Bugsnag, we need to create a new account and create our new project. You can start with a 30 day free trial and switch to a paid plan depending on your application’s size. After signing up, you’ll have to create a new project and specify your project type. In our case, that’ll be PHP.
在开始使用Bugsnag之前,我们需要创建一个新帐户并创建我们的新项目。 您可以从30天免费试用开始,然后根据应用程序的大小切换到付费计划。 注册后,您必须创建一个新项目并指定您的项目类型。 在我们的例子中,将是PHP。
将BugSnag添加到我们的项目中 (Adding BugSnag to Our Project)
Bugsnag provides a list of notifiers for different application types. We’re going to install and configure the PHP notifier package. Alternatively, because the demo application is built using Laravel 4, you may want use the Laravel package and follow the Laravel integration guide to easily set up your project, but in this case, we’ll take a more framework-agnostic approach.
Bugsnag提供了针对不同应用程序类型的通知程序列表 。 我们将安装和配置PHP通告程序包 。 另外,由于演示应用程序是使用Laravel 4构建的,因此您可能需要使用Laravel软件包并遵循Laravel集成指南来轻松设置项目,但是在这种情况下,我们将采用与框架无关的方法。
Require
bugsnag/bugsnag:2.*
using Composer.使用Composer需要
bugsnag/bugsnag:2.*
。Grab your project API key from
project dashboard > settings
in Bugsnag’s control panel. You can store your API key in your environment variables or inside a configuration file depending on your application. In this case, we’re going to add it to ourapp/config/app.php
.