ClientAgentLogger.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * The contents of this file are subject to the Mozilla Public
  3. * License Version 1.1 (the "License"); you may not use this file
  4. * except in compliance with the License. You may obtain a copy of
  5. * the License at http://www.mozilla.org/MPL/
  6. *
  7. * Software distributed under the License is distributed on an "AS
  8. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9. * implied. See the License for the specific language governing
  10. * rights and limitations under the License.
  11. *
  12. * The Original Code is Vision.
  13. *
  14. * The Initial Developer of the Original Code is The Vision Team.
  15. * Portions created by The Vision Team are
  16. * Copyright (C) 1999, 2000, 2001 The Vision Team. All Rights
  17. * Reserved.
  18. *
  19. * Contributor(s): Wade Majors <wade@ezri.org>
  20. * Rene Gollent
  21. * Todd Lair
  22. */
  23. #ifndef _CLIENTAGENTLOGGER_H_
  24. #define _CLIENTAGENTLOGGER_H_
  25. #include <File.h>
  26. #include <Locker.h>
  27. #include <Path.h>
  28. #include <String.h>
  29. #include "ObjectList.h"
  30. #include <map>
  31. typedef std::map<BString, BFile> filemap;
  32. class ClientAgentLogger
  33. {
  34. public:
  35. ClientAgentLogger (BString);
  36. virtual ~ClientAgentLogger (void);
  37. void StartLogging (void);
  38. void RegisterLogger (const char *);
  39. void UnregisterLogger (const char *);
  40. void Log (const char *, const char *);
  41. void StopLogging (void);
  42. bool fIsQuitting;
  43. bool fIsLogging;
  44. private:
  45. void SetupLogging (void);
  46. void CloseSession (BFile &);
  47. static int32 AsyncLogger (void *);
  48. thread_id fLogThread;
  49. BString fServerName;
  50. BPath fLogPath;
  51. BObjectList<BString> *fLogBuffer;
  52. BLocker *fLogBufferLock;
  53. sem_id fLogSyncherLock;
  54. bool fNewLine;
  55. filemap fLogFiles;
  56. bool fLogSetupDone;
  57. };
  58. #endif