about summary refs log tree commit diff
path: root/bounce.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-10-02 18:40:19 -0400
committerJune McEnroe <june@causal.agency>2021-10-02 19:51:40 -0400
commitc63c1683414c044a16722e9f1e738dd6ea63ec69 (patch)
tree847a9cca0368e0a5b673c65cf54e2a9f3f6ef59a /bounce.h
parentExplain what pounce does and some of how it works in README (diff)
downloadpounce-c63c1683414c044a16722e9f1e738dd6ea63ec69.tar.gz
pounce-c63c1683414c044a16722e9f1e738dd6ea63ec69.zip
Log IRC to standard output with -v
So that it can actually be logged to a file separate from any errors
or status messages. Also make sure only LF is used when logging.
Diffstat (limited to '')
-rw-r--r--bounce.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/bounce.h b/bounce.h
index 4144324..af3bcc3 100644
--- a/bounce.h
+++ b/bounce.h
@@ -167,6 +167,13 @@ static inline const char *capList(enum Cap caps, const char *values[CapBits]) {
 }
 
 extern bool verbose;
+static inline void
+verboseLog(const char *prefix, const char *line, size_t len) {
+	if (!verbose) return;
+	if (len && line[len - 1] == '\n') len--;
+	if (len && line[len - 1] == '\r') len--;
+	printf("%s %.*s\n", prefix, (int)len, line);
+}
 
 void ringAlloc(size_t len);
 void ringProduce(const char *line);