Differences between revisions 1 and 2
Revision 1 as of 2013-02-19 23:12:00
Size: 1681
Editor: mpkfw
Comment:
Revision 2 as of 2013-02-19 23:15:58
Size: 1681
Editor: mpkfw
Comment:
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
2013/02/13 15:05:19 durham> pull -u 2013/02/13 15:06:11 durham> pull -u
Line 22: Line 22:
2013/02/13 15:06:42 durham> pull exited None after 3.28 seconds 2013/02/13 15:06:14 durham> pull exited None after 3.28 seconds
Line 24: Line 24:
2013/02/13 15:30:44 durham> log exited None after 0.75 seconds 2013/02/13 15:30:37 durham> log exited None after 0.75 seconds

Blackbox Extension

This extension will be distributed with Mercurial 2.6 and up.

Author: Durham Goode

1. Overview

This extension logs events to .hg/blackbox.log to help debug issues that occur later. It is useful for administrators to see what a user has done recently when trying to fix a repository. By default it logs:

  • user commands and exit codes
  • unhandled exceptions
  • incoming revisions
  • hooks that are run

You can view the recent log entries using the hg blackbox command. Each log entry includes the date, time, and the user performing the action.

Example log:

$ hg blackbox
2013/02/13 15:06:11 durham> pull -u
2013/02/13 15:06:14 durham> 17 incoming changes - new heads: 7daed3c67aaa
2013/02/13 15:06:14 durham> pull exited None after 3.28 seconds
2013/02/13 15:30:36 durham> log -l 1 --stat
2013/02/13 15:30:37 durham> log exited None after 0.75 seconds

2. Configuration

You can configure which events get logged by changing the blackbox.track setting in your .hgrc.

Log only user commands:

[blackbox]
track=command, commandfinish, commandexception

Log only incoming revisions:

[blackbox]
track=incoming

Log only hooks:

[blackbox]
track=exthook, pythonhook

3. Logging Your Own Events

If you want to log to the blackbox from another extension or from elsewhere in mercurial, just call ui.log like so:

ui.log("myeventkind", "Something happened\n")

If the blackbox extension is enabled, your event will be logged as:

2013/02/13 15:30:44 durham> Something happened


CategoryBundledExtension

BlackboxExtension (last edited 2014-04-03 11:35:18 by MartinGeisler)