jenssegers / laravel-rollbar

Rollbar error monitoring integration for Laravel projects
329 stars 99 forks source link

Override environment #10

Closed lowerends closed 9 years ago

lowerends commented 9 years ago

Great working package, also with Laravel 5, thanks!

Is there a way to override the environment variable that is sent to Rollbar? Currently this is set in the constructor to Laravel's app environment, but I was wondering if this could be overridden from the configuration settings. It would be something like this:

'rollbar' => array(
    'access_token' => 'access-token',
    'level' => 'debug',
    'environment' => 'custom-environment-string',
),

If it's not possible yet and you're open for it, then I'd be happy to create a pull request for this somewhere in the coming weeks.

jnbn commented 9 years ago

@lowerends i saw your issue and wanted to ask why did you actually need such a functionality instead of changing (or switching) your app environment?

Anyway, i think you can change line:43 on RollbarLogHandler.php $this->rollbar->environment = $this->app->environment(); to suit your needs with something like

if(isset(Config::get('services.rollbar.environnment')){
...
}

but i think it won't be so functional for the project.

lowerends commented 9 years ago

@jnbn the thing is that the Rollbar 'environment' parameter is not necessarily limited to things like 'production' and 'development' (which is typically used for Laravel projects). It could be anything, like a specific server or a specific customer that you want to group separately in the Rollbar reporting. Does this answer your question?

jnbn commented 9 years ago

@lowerends yeah i think i understood your concerns but even in your conditions i'd still consider changing the local env name for server and/or pass the correct person data as an array and use RQL for reporting.

Anyway you may still change the configuration from RollbarLogHandler.php according to your needs as I said before.