code: def log(self, n=None, **kwargs):
          
          kwargs['format'] = kwargs.pop('template', self.template)
          cmd = ['git', 'log']
          if n:
              cmd.append('-n%d' % n)
          cmd.extend(
              (('--%s=%s' % (k, v))
               for (k, v) in iteritems(kwargs)))
          try:
              output = self.sh(cmd, shell=False)
              if "fatal: bad default revision 'HEAD'" in output:
                  return output
              return output
          except Exception as e:
              e
              return
docs: Run the repository log command
  
          Returns:
              str: output of log command (``git log -n <n> <--kwarg=value>``)