src/mercurialserver/servelog.py
changeset 377 18869fcfbc92
parent 375 a41e4382ea6e
equal deleted inserted replaced
376:d503d5a786f3 377:18869fcfbc92
    31     logentry.update(dict(
    31     logentry.update(dict(
    32         timestamp=time.strftime("%Y-%m-%d_%H:%M:%S Z", time.gmtime()),
    32         timestamp=time.strftime("%Y-%m-%d_%H:%M:%S Z", time.gmtime()),
    33         op=op,
    33         op=op,
    34         key=ruleset.rules.get('user'),
    34         key=ruleset.rules.get('user'),
    35         ssh_connection=os.environ['SSH_CONNECTION'],))
    35         ssh_connection=os.environ['SSH_CONNECTION'],))
    36     with open(repo.join("mercurial-server.log"), "a+") as log:
    36     with open(repo.vfs.join("mercurial-server.log"), "a+") as log:
    37         fcntl.flock(log.fileno(), fcntl.LOCK_EX)
    37         fcntl.flock(log.fileno(), fcntl.LOCK_EX)
    38         log.seek(0, os.SEEK_END)
    38         log.seek(0, os.SEEK_END)
    39         # YAML log file format
    39         # YAML log file format
    40         log.write("- %s\n" % json.dumps(data))
    40         log.write("- %s\n" % json.dumps(data))
    41     
    41