Skip to content

Commit

Permalink
Merge pull request #20 from lusitania/fileConfig
Browse files Browse the repository at this point in the history
Signature change as proposed in issue #16
  • Loading branch information
stavxyz committed Oct 29, 2014
2 parents d87bea0 + 0fdadcd commit c7f53e1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions airbrake/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,20 @@ class AirbrakeHandler(logging.Handler):
* an instance of airbrake.Airbrake
"""

def __init__(self, airbrake=None, level=logging.ERROR, **kwargs):
def __init__(self, airbrake=None, level=logging.ERROR, project_id=None, api_key=None, environment=None):
"""Initialize the Airbrake handler with a default logging level.
Default level of logs handled by this class are >= ERROR,
which includes ERROR and CRITICAL. To change this behavior
supply a different arguement for 'level'.
All 'kwargs' will be passed to notifier.Airbrake to instantiate
a notifier client.
supply a different argument for 'level'.
"""

logging.Handler.__init__(self, level=level)

if isinstance(airbrake, Airbrake):
self.airbrake = airbrake
else:
self.airbrake = Airbrake(**kwargs)
self.airbrake = Airbrake(project_id, api_key, environment)

def emit(self, record):
"""Log the record airbrake.io style.
Expand Down

0 comments on commit c7f53e1

Please sign in to comment.