Commit Graph

14 Commits

Author SHA1 Message Date
Jakob Borg f7fc0c1d3e all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
Jakob Borg f7ad97918a HTTP debug middleware should be behind ShouldDebug() 2015-11-21 09:39:40 +01:00
Audrius Butkevicius 5b03c2d949 Remove dead code 2015-10-25 20:46:09 +00:00
Jakob Borg 76af9ba53d Implement facility based logger, debugging via REST API
This implements a new debug/trace infrastructure based on a slightly
hacked up logger. Instead of the traditional "if debug { ... }" I've
rewritten the logger to have no-op Debugln and Debugf, unless debugging
has been enabled for a given "facility". The "facility" is just a
string, typically a package name.

This will be slightly slower than before; but not that much as it's
mostly a function call that returns immediately. For the cases where it
matters (the Debugln takes a hex.Dump() of something for example, and
it's not in a very occasional "if err != nil" branch) there is an
l.ShouldDebug(facility) that is fast enough to be used like the old "if
debug".

The point of all this is that we can now toggle debugging for the
various packages on and off at runtime. There's a new method
/rest/system/debug that can be POSTed a set of facilities to enable and
disable debug for, or GET from to get a list of facilities with
descriptions and their current debug status.

Similarly a /rest/system/log?since=... can grab the latest log entries,
up to 250 of them (hardcoded constant in main.go) plus the initial few.

Not implemented in this commit (but planned) is a simple debug GUI
available on /debug that shows the current log in an easily pasteable
format and has checkboxes to enable the various debug facilities.

The debug instructions to a user then becomes "visit this URL, check
these boxes, reproduce your problem, copy and paste the log". The actual
log viewer on the hypothetical /debug URL can poll regularly for new log
entries and this bypass the 250 line limit.

The existing STTRACE=foo variable is still obeyed and just sets the
start state of the system.
2015-10-03 18:09:53 +02:00
Jakob Borg 76ad925842 Refactor config commit stuff to support restartless updates better
Includes restartless updates of the GUI settings (listening port etc) as
a proof of concept.
2015-06-09 15:41:22 +02:00
Jakob Borg d7100fd9bc Add HTTP request tracing 2015-04-07 21:52:47 +02:00
Jakob Borg 32425c5561 MPLv2 2015-03-17 16:02:27 +01:00
Jakob Borg 82c6caef85 Use more inclusive copyright header 2014-11-17 12:54:42 +01:00
Jakob Borg 9edce23e76 Relicense to GPL 2014-10-01 07:53:59 +02:00
Jakob Borg 0a633c526f Copyright wording 2014-07-13 01:07:49 +02:00
Jakob Borg 843fd9bdbd Add license header 2014-06-01 22:50:14 +02:00
Jakob Borg 3e34fc66e6 Refactor model into separate package 2014-05-15 00:33:40 -03:00
Jakob Borg cba554d0fa Refactor logging into separate package 2014-05-14 21:08:56 -03:00
Jakob Borg 2553ba0463 Discover & main tracing 2014-03-09 09:15:36 +01:00