aboutsummaryrefslogtreecommitdiff
path: root/src/rt/rust_log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rt/rust_log.h')
-rw-r--r--src/rt/rust_log.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/rt/rust_log.h b/src/rt/rust_log.h
new file mode 100644
index 00000000..b0c5fbec
--- /dev/null
+++ b/src/rt/rust_log.h
@@ -0,0 +1,59 @@
+#ifndef RUST_LOG_H_
+#define RUST_LOG_H_
+
+class rust_dom;
+
+class rust_log {
+ rust_srv *_srv;
+ rust_dom *_dom;
+ uint32_t _type_bit_mask;
+ bool _use_colors;
+ uint32_t _indent;
+ void trace_ln(char *message);
+public:
+ rust_log(rust_srv *srv, rust_dom *dom);
+ virtual ~rust_log();
+
+ enum ansi_color {
+ BLACK,
+ GRAY,
+ WHITE,
+ RED,
+ LIGHTRED,
+ GREEN,
+ LIGHTGREEN,
+ YELLOW,
+ LIGHTYELLOW,
+ BLUE,
+ LIGHTBLUE,
+ MAGENTA,
+ LIGHTMAGENTA,
+ TEAL,
+ LIGHTTEAL
+ };
+
+ enum log_type {
+ ERR = 0x1,
+ MEM = 0x2,
+ COMM = 0x4,
+ TASK = 0x8,
+ DOM = 0x10,
+ ULOG = 0x20,
+ TRACE = 0x40,
+ DWARF = 0x80,
+ CACHE = 0x100,
+ UPCALL = 0x200,
+ TIMER = 0x400,
+ ALL = 0xffffffff
+ };
+
+ void indent();
+ void outdent();
+ void reset_indent(uint32_t indent);
+ void trace_ln(uint32_t type_bits, char *message);
+ void trace_ln(ansi_color color, uint32_t type_bits, char *message);
+ bool is_tracing(uint32_t type_bits);
+ static ansi_color get_type_color(log_type type);
+};
+
+#endif /* RUST_LOG_H_ */