home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / system / log.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.1 KB  |  71 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    System library component
  3. //    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. //
  5. //    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. //    differently than the remainder of VirtualDub.  This particular file is
  7. //    thus licensed as follows (the "zlib" license):
  8. //
  9. //    This software is provided 'as-is', without any express or implied
  10. //    warranty.  In no event will the authors be held liable for any
  11. //    damages arising from the use of this software.
  12. //
  13. //    Permission is granted to anyone to use this software for any purpose,
  14. //    including commercial applications, and to alter it and redistribute it
  15. //    freely, subject to the following restrictions:
  16. //
  17. //    1.    The origin of this software must not be misrepresented; you must
  18. //        not claim that you wrote the original software. If you use this
  19. //        software in a product, an acknowledgment in the product
  20. //        documentation would be appreciated but is not required.
  21. //    2.    Altered source versions must be plainly marked as such, and must
  22. //        not be misrepresented as being the original software.
  23. //    3.    This notice may not be removed or altered from any source
  24. //        distribution.
  25.  
  26. #ifndef f_VD2_SYSTEM_LOG_H
  27. #define f_VD2_SYSTEM_LOG_H
  28.  
  29. #include <vd2/system/VDString.h>
  30. #include <list>
  31.  
  32. class IVDLogger {
  33. public:
  34.     virtual void AddLogEntry(int severity, const VDStringW& s) = 0;
  35. };
  36.  
  37. enum {
  38.     kVDLogInfo, kVDLogMarker, kVDLogWarning, kVDLogError
  39. };
  40.  
  41. void VDLog(int severity, const VDStringW& s);
  42. void VDLogF(int severity, const wchar_t *format, ...);
  43. void VDAttachLogger(IVDLogger *pLogger, bool bThisThreadOnly, bool bReplayLog);
  44. void VDDetachLogger(IVDLogger *pLogger);
  45.  
  46. class VDAutoLogger : public IVDLogger {
  47. public:
  48.     struct Entry {
  49.         int severity;
  50.         VDStringW text;
  51.  
  52.         Entry(int sev, const VDStringW& s) : severity(sev), text(s) {}
  53.     };
  54.  
  55.     typedef std::list<Entry>    tEntries;
  56.  
  57.     VDAutoLogger(int min_severity);
  58.     ~VDAutoLogger();
  59.  
  60.     void AddLogEntry(int severity, const VDStringW& s);
  61.  
  62.     const tEntries& GetEntries();
  63.  
  64. protected:
  65.     tEntries mEntries;
  66.     const int mMinSeverity;
  67.     bool    mbAttached;
  68. };
  69.  
  70. #endif
  71.