1

Below is the __init__ function of bunyan logger.

 def __init__(self, *args, **kwargs):
    """Defined default log format."""
    self._required_fields = [
      'asctime',
      'exc_info',
      'levelno',
      'message',
      'name',
      'process',
    ]
    self._skip_fields = self._required_fields[:]
    self._skip_fields += [
      'args',
      'created',
      'exc_text',
      'filename',
      'funcName',
      'levelname',
      'lineno',
      'module',
      'msecs',
      'pathname',
      'processName',
      'relativeCreated',
      'stack_info',
      'thread',
      'threadName',
    ]

filename, funcName and lineno are skipped by default. Is there any way I can include them by still being to use python-bunyan?

Eb946207
  • 748
  • 8
  • 26
MANOJ
  • 716
  • 4
  • 10
  • 29

1 Answers1

0

Remove them from the list after the object is created.

X = Logger()
for field in ['filename', 'funcName', 'lineno']:
    X._skip_fields.remove(field)
Dan D.
  • 73,243
  • 15
  • 104
  • 123