]> git.mxchange.org Git - simgear.git/blobdiff - simgear/debug/logstream.hxx
Tweak HTTP code to always sleep.
[simgear.git] / simgear / debug / logstream.hxx
index f50a4cc2124489ce204943993eb53ae5888b1d42..d4fa0e48431ac4ba1e8824a895f033455aeaba92 100644 (file)
 #include <simgear/compiler.h>
 #include <simgear/debug/debug_types.h>
 
-#include <vector>
 #include <sstream>
-#include <memory> // for std::auto_ptr
-     
-typedef std::vector<std::string> string_list;
  
 // forward decls
 class SGPath;
@@ -46,28 +42,23 @@ public:
     virtual ~LogCallback() {}
     virtual void operator()(sgDebugClass c, sgDebugPriority p, 
         const char* file, int line, const std::string& aMessage) = 0;
-};
-     
-     
-class BufferedLogCallback : public LogCallback
-{
-public:
-    BufferedLogCallback(sgDebugClass c, sgDebugPriority p);
-    virtual ~BufferedLogCallback();
-    
-    virtual void operator()(sgDebugClass c, sgDebugPriority p, 
-        const char* file, int line, const std::string& aMessage);
-    
-    /**
-     * copy the buffered log data into the provided output list
-     * (which will be cleared first). This method is safe to call from
-     * any thread.
-     */
-    void threadsafeCopy(string_list& aOutput);
+
+       void setLogLevels(sgDebugClass c, sgDebugPriority p);
+protected:
+       LogCallback(sgDebugClass c, sgDebugPriority p);
+
+       bool shouldLog(sgDebugClass c, sgDebugPriority p) const;
 private:
-    class BufferedLogCallbackPrivate;
-    std::auto_ptr<BufferedLogCallbackPrivate> d;
+       sgDebugClass m_class;
+       sgDebugPriority m_priority;
 };
+
+/**
+ * Helper force a console on platforms where it might optional, when
+ * we need to show a console. This basically means Windows at the
+ * moment - on other plaforms it's a no-op
+ */
+void requestConsole();
      
 } // of namespace simgear
 
@@ -118,9 +109,8 @@ public:
      * must use appropriate locking.
      */
     void addCallback(simgear::LogCallback* cb);
-    
-  //  friend logstream& sglog();
-//    static logstream *initGlobalLogstream();
+     
+    void removeCallback(simgear::LogCallback* cb);
 
 private:
     // constructor
@@ -129,6 +119,8 @@ private:
 
 logstream& sglog();
 
+
+
 /** \def SG_LOG(C,P,M)
  * Log a message.
  * @param C debug class