Size: 1681
Comment:
|
← Revision 4 as of 2014-04-03 11:35:18 ⇥
Size: 1742
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
== Blackbox Extension == | #pragma section-numbers 2 = Blackbox Extension = |
Line 3: | Line 4: |
'''This extension will be distributed with Mercurial 2.6 and up.''' | '''This extension is distributed with Mercurial 2.6 and up.''' |
Line 7: | Line 8: |
=== 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: |
The blackbox extension logs events to ''`.hg/blackbox.log`'' for post-mortem debugging. It is useful for administrators to find out what a user did recently when trying to fix a repository. <<TableOfContents>> == Events == By default the extension logs the following events: |
Line 15: | Line 20: |
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: |
The recent log entries can be viewed with the '`hg blackbox`' command. Each log entry includes the date, time, and the user performing the action. |
Line 20: | Line 23: |
2013/02/13 15:05:19 durham> pull -u | 2013/02/13 15:06:11 durham> pull -u |
Line 22: | Line 25: |
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 27: |
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 |
Line 27: | Line 30: |
=== Configuration === You can configure which events get logged by changing the blackbox.track setting in your .hgrc. |
== Configuration == Which events are logged can be configured by changing the blackbox.track setting in ''`.hgrc`''. |
Line 48: | Line 51: |
=== 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: |
== Logging custom events == It's possible to log custom events to the blackbox from another extension or from elsewhere in mercurial by calling {{{ui.log}}} like so: |
Line 53: | Line 56: |
If the blackbox extension is enabled, your event will be logged as: | If the blackbox extension is enabled, the event will be logged as: |
Blackbox Extension
This extension is distributed with Mercurial 2.6 and up.
Author: Durham Goode
The blackbox extension logs events to .hg/blackbox.log for post-mortem debugging. It is useful for administrators to find out what a user did recently when trying to fix a repository.
Contents
1. Events
By default the extension logs the following events:
- user commands and exit codes
- unhandled exceptions
- incoming revisions
- hooks that are run
The recent log entries can be viewed with the 'hg blackbox' command. Each log entry includes the date, time, and the user performing the action.
$ 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
Which events are logged can be configured by changing the blackbox.track setting in .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 custom events
It's possible to log custom events to the blackbox from another extension or from elsewhere in mercurial by calling ui.log like so:
ui.log("myeventkind", "Something happened\n")
If the blackbox extension is enabled, the event will be logged as:
2013/02/13 15:30:44 durham> Something happened