summaryrefslogtreecommitdiff
path: root/common/console.h
diff options
context:
space:
mode:
authorleo2001-12-04 17:57:25 +0000
committerleo2001-12-04 17:57:25 +0000
commit5a86ba19f529e433846b5a6fef0f9f038b70d900 (patch)
tree7071f7809afcc8573e811aedf3eb27b005be5cd8 /common/console.h
parent8834b8c2f556fa41be984d2a16e832d77a7afe9f (diff)
Log system
git-svn-id: http://svn.leocad.org/trunk@273 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/console.h')
-rw-r--r--common/console.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/common/console.h b/common/console.h
new file mode 100644
index 0000000..d3aac8a
--- /dev/null
+++ b/common/console.h
@@ -0,0 +1,42 @@
+#ifndef _CONSOLE_H_
+#define _CONSOLE_H_
+
+typedef enum
+{
+ LC_CONSOLE_ERROR,
+ LC_CONSOLE_WARNING,
+ LC_CONSOLE_DEBUG,
+ LC_CONSOLE_MISC
+} LC_CONSOLE_LEVEL;
+
+typedef void (*CONSOLECALLBACK) (LC_CONSOLE_LEVEL level, const char* text, void* user_data);
+
+class Console
+{
+public:
+ Console ();
+ virtual ~Console ();
+
+ void Print (LC_CONSOLE_LEVEL level, const char* format, ...);
+ void PrintMisc (const char* format, ...);
+ void PrintDebug (const char* format, ...);
+ void PrintWarning (const char* format, ...);
+ void PrintError (const char* format, ...);
+
+ void SetWindowCallback (CONSOLECALLBACK func, void* data)
+ { m_pWindowFunc = func; m_pWindowFuncData = data; };
+
+protected:
+ void InternalPrint (LC_CONSOLE_LEVEL level, const char* text);
+
+ CONSOLECALLBACK m_pWindowFunc;
+ void* m_pWindowFuncData;
+
+ // variables
+ bool use_tty;
+ bool use_file;
+};
+
+extern Console console;
+
+#endif // _CONSOLE_H_