import logging

class SentryHandler(logging.Handler):
    def emit(self, record):
        from sentry.client.models import get_client

        get_client().create_from_record(record)
import logging
import sys

class SentryHandler(logging.Handler):
    def emit(self, record):
        from sentry.client.models import get_client

        # Avoid typical config issues by overriding loggers behavior
        if record.name == 'sentry.errors':
            print >> sys.stderr, record.message
            return

        get_client().create_from_record(record)
Add a safety net for recursive logging
Add a safety net for recursive logging

  import logging
+ import sys
  
  class SentryHandler(logging.Handler):
      def emit(self, record):
          from sentry.client.models import get_client
  
+         # Avoid typical config issues by overriding loggers behavior
+         if record.name == 'sentry.errors':
+             print >> sys.stderr, record.message
+             return
+ 
          get_client().create_from_record(record)
Add a safety net for recursive logging
## Code Before:
import logging

class SentryHandler(logging.Handler):
    def emit(self, record):
        from sentry.client.models import get_client

        get_client().create_from_record(record)
## Instruction:
Add a safety net for recursive logging
## Code After:
import logging
import sys

class SentryHandler(logging.Handler):
    def emit(self, record):
        from sentry.client.models import get_client

        # Avoid typical config issues by overriding loggers behavior
        if record.name == 'sentry.errors':
            print >> sys.stderr, record.message
            return

        get_client().create_from_record(record)