Commit Graph

67 Commits

Author SHA1 Message Date
Jeremy Lakeman
10ce16e1f3 Fix reading port number 2012-12-04 15:53:32 +10:30
Jeremy Lakeman
627e86fb73 Shift all payload header writing to one place 2012-11-28 15:43:58 +10:30
Andrew Bettison
0e435683f7 Move toprint functions from log.h to str.h
Move alloca_sockaddr() to strbuf_helpers.h

So that stand-alone executables can use them without pulling in the entire
logging framework.
2012-11-20 18:10:08 +10:30
Andrew Bettison
6395f757cc Fix bugs in earlier conf/log recursion logic
Reinstate better recursion control in conf.c, remove from log.c.

Add <kludge> comment to "config set" code, add the same kludge to "config
del".
2012-11-15 12:38:17 +10:30
Andrew Bettison
9c69eaca1c Improve logic to avoid log/config infinite recursion
Put logic in log.c, remove from conf.c.  Now messages logged while logging
another message will get appended to the log buffer, and eventually flushed.
2012-11-14 13:16:23 +10:30
Andrew Bettison
ff7a61c5bc Fix mkstemp() error in log_backtrace()
The template only had five XXXXX but needed six.
2012-10-18 17:20:50 +10:30
Andrew Bettison
259b9a9d24 Logging/debug improvements: __WHENCE__, __whence
Introduce __WHENCE__ macro and a block comment in log.h explaining it.

In "primitive" kinds of functions, rename 'whence' arguments to '__whence' and
use WHYF(), WARNF(), DEBUGF() macros instead of calling logMessage() directly.
2012-10-16 17:00:03 +10:30
Andrew Bettison
f4d0b7a16a Fix some minor bugs in recent commits 2012-10-10 18:13:31 +10:30
Andrew Bettison
2a8cfb0404 Quieten Rhizome advertisement debug logging
Introduce DEBUG_RHIZOME_ADS and sqlite_set_debugmask(), use in
rhizome_packetformats.c advertisement mustering and processing code.
2012-10-10 13:22:30 +10:30
Andrew Bettison
04d50e0057 Typedef debugflags_t replaces (unsigned int) 2012-10-10 13:21:20 +10:30
Andrew Bettison
f527ae9425 Improve dump() debugging function
Now dump() accepts any type of pointer to the data.

Also tidied up some other debugging macro definitions to reduce duplication of
code.
2012-10-04 11:40:40 +09:30
Andrew Bettison
62f8d223ea Improve alloca_toprint() functions
Replace "..." quoting with `...` quoting in output, to avoid slosh-escaping the
common double-quote character (") in log output.

Introduce alloca_str_toprint() function that produces an entire null-terminated
string in printable form.

Change various toprint strbuf helper functions to take two optional quote chars
instead of one mandatory.
2012-09-28 17:46:40 +09:30
Daniel O'Connor
03275f410f Include stdint.h for intmax_t. 2012-09-06 15:26:40 +09:30
Paul Gardner-Stephen
3fd262c6f8 Add Solaris method for getting executable path & make the compiler
bail out if there is no method available rather than waiting until
runtime.
2012-09-06 07:52:22 +09:30
Paul Gardner-Stephen
bba6839656 Initial stab at porting to Solaris.
It compiles without warning (with CC=gcc) but doesn't link
because NaCL doesn't build yet.
2012-09-05 20:42:50 +09:30
Andrew Bettison
27a0a6eeb5 Introduce struct __sourceloc
Replaces (const char *file, unsigned int line, const char *function) arguments
to all logging functions, simplifies malloc/free tracking code in
overlay_buffer.c and Rhizome manifest alloc/free tracking in rhizome_bundle.c.

Use __HERE__ macro instead of (__FILE__, __LINE__, __FUNCTION__) everywhere.

Special __NOWHERE__ macro is equivalent to (NULL, 0, NULL).

Declare net.c functions in new "net.h" header, so log.c doesn't have to pull
in the entire "serval.h" just to use write_str().

Facilitates progress on issue #2.
2012-08-23 12:31:07 +09:30
Jeremy Lakeman
f059546eb0 Improve monitor client interface and vomp for asterisk channel driver 2012-08-09 13:32:08 +09:30
Daniel O'Connor
0d5ecb4a9e Move system headers up top so we compile on Ubuntu 10.04 2012-08-06 17:01:29 +09:30
Andrew Bettison
fa03b7e667 Fix bug in alloca_toprint() that caused SEGV 2012-08-06 15:39:08 +09:30
Andrew Bettison
9ede55ab4c Fix DEBUG_packet_visualise() log output 2012-08-03 13:12:54 +09:30
Andrew Bettison
ee6d9d8ea3 Fix logging in vomp.c
Replace DEBUG_SIMULATION with DEBUG_VOMP

Replace all printf(...) and fprintf(stderr,...) with WHYF(...) and DEBUGF(...)

Make all debug logging conditional on DEBUG_VOMP
2012-08-02 11:29:37 +09:30
Andrew Bettison
560e0c6699 Add logString() function 2012-08-01 17:52:38 +09:30
Andrew Bettison
dbef192513 Improve dump() logging primitive 2012-07-31 16:20:09 +09:30
Andrew Bettison
f002f5b9fd Refactor log.h constants.h serval.h
Move DEBUG_ and LOG_LEVEL_ macro constants from constants.h into log.h.

Move dumpResponses() out of log.c, so that log.h is almost ready for re-use
(still depends on conf.h).

Remove unused and now obsolete catv() function -- replaced with toprint()
and alloca_toprint().

Add copyright/licence comments, fix up some copyright attributions.

Add #ifndef..#define..#endif __SERVALD_FOO_H to header files: log.h serval.h
constants.h
2012-07-30 16:15:42 +09:30
gardners
93449d380e various fixes for libmonitorclient and commits made by others
inbetween. Hopefully I have captured all the changes.
2012-07-29 12:35:53 +09:30
Andrew Bettison
8db737ee6f Quieten startup logging a bit 2012-07-27 19:59:16 +09:30
Andrew Bettison
2152c9267f DEBUG_VERBOSE log messages for all command-line commands 2012-07-27 18:04:46 +09:30
Andrew Bettison
3b1adc3a31 Add DEBUG_argv() and WHY_argv() macros
Implemented usng new logArgv() function.

Refactored logMessage()
2012-07-27 18:04:46 +09:30
Andrew Bettison
a69f637b3a Replace DEBUG_HLR with DEBUG_KEYRING
Convert several fprintf(stderr,...) into DEBUGF() statements
2012-07-27 11:26:19 +09:30
Andrew Bettison
82648b7e63 Improve logging -- first log INFO message 2012-07-26 18:34:50 +09:30
Andrew Bettison
81cafe9d6f Improve log_backtrace() function
Add BACKTRACE macro.  Improve gdb output buffering: log each line individually,
read progressively, reduce buffer size.  Log diagnostics if gdb cannot be run.
2012-07-26 16:51:59 +09:30
Andrew Bettison
6b23bcba51 Enable log_backtrace() on Mac OS X (untested) 2012-07-25 18:19:32 +09:30
Andrew Bettison
04b95d2590 Merge branch 'andrew' into 'master' 2012-07-25 18:04:16 +09:30
Andrew Bettison
2b57773472 Add log_backtrace() function 2012-07-25 17:02:57 +09:30
Jeremy Lakeman
5ec739c712 Add performance timing debug option 2012-07-25 13:33:30 +09:30
Andrew Bettison
0e5c5e0e98 More work on dnahelper, almost done
Servald starts DNA helper, receives startup ACK, sends requests, receives
responses, handles malformed helper responses, echoes dnahelper stderr lines to
log, sends MDP reply packet, waits for dead helper process, all asynchronously.
Shuts down helper process during servald shutdown.

Remaining issues:
 - Does not impose a timeout on helper responses.
 - Only the first URI is reported by the "dna lookup" command.
2012-07-20 18:17:43 +09:30
Andrew Bettison
3b44bb6e58 More progress on dnahelper 2012-07-19 17:59:45 +09:30
Andrew Bettison
0c260a966e Small improvement in toprint() 2012-07-13 18:00:25 +09:30
Andrew Bettison
41f3228300 Refactor rhizome HTTP request parsing
Replace DEBUG_RHIZOMESYNC with DEBUG_RHIZOME_TX
2012-07-13 11:06:10 +09:30
Andrew Bettison
025ccad810 Replace DEBUG_DNAVARS with DEBUG_RHIZOME_RX
Delete some obsolete HLR code
Mark DEBUG_HLR as deprecated
2012-07-12 16:26:37 +09:30
Andrew Bettison
bdd0bb357f Improve logging config options
Rename config option "logfile" to "log.file"
Add "log.show_pid" boolean
Add "log.show_time" boolean
2012-07-11 17:09:50 +09:30
Andrew Bettison
f50da147d6 Fix log.c: open_logging() sets log_pid and log_time vars 2012-07-11 16:59:08 +09:30
Jeremy Lakeman
51d66f5d9e Fix compilation for android 2012-07-11 16:05:03 +09:30
Andrew Bettison
6556637251 Add HH:MM:SS.mmm timestamp to non-Android log entries 2012-07-11 14:18:36 +09:30
Andrew Bettison
a15a9146c3 Improve toprint() and alloca_toprint() 2012-07-11 14:17:53 +09:30
Andrew Bettison
69ff860b4f Add rhizome sync logging to 'rhizomeprotocol' test 2012-07-10 20:00:20 +09:30
Andrew Bettison
e8eab5b27e Improve diagnostics from write_all(), write_nonblock() etc.
Add toprint() function and alloca_toprint() macro.
2012-07-10 19:57:56 +09:30
Jeremy Lakeman
624be364bf fix android log spam 2012-07-10 14:33:07 +09:30
Andrew Bettison
a80da50636 Finish rewriting configuration and logging code
Fix endless recursion if error or debug logged while reading config file
Fix 'config del' logic
Log messages made before log file can be opened are buffered and written
once the file is open
Do not log to file in ANDROID version, just to Android's log system
2012-07-05 14:59:50 +09:30
Andrew Bettison
ab64b08ceb Rewrite config file code
Gets rid of rotor in confValueGet() and duplicate config file parsing code
Currently fails three tests
2012-07-04 18:57:02 +09:30