sP2P c++ STL *nix API  1.2
NAT traversal and peer-to-peer networking API providing all utilities needed to build peer-to-peer application straigth out of box
 All Classes Functions Variables Typedefs Enumerations Enumerator
Logger.h
1 /*
2 #################################################################################################
3 # sP2P NAT Traversal/Peer-To-Peer networking API
4 #
5 # This file is part of comercial product. You can not use it in any way, redistribute it
6 # in any way and/or modify it in any way unless you get right to do so.
7 #
8 # Use licence can only be acquired from:
9 # ---------------------------------------------------
10 # AS-CAL,raziskave in razvoj, d.o.o.
11 # Kongresni trg 9, 1000 Ljubljana - Slovenia
12 # Company ID: 3913147000
13 # ---------------------------------------------------
14 # , or product legal successor.
15 #
16 #################################################################################################
17 # Ivan Milic
18 # HOLEST Engineering
19 # www.holest.com
20 # Belgrade, Serbia
21 # January, 2013
22 ##################################################################################################
23 */
24 
25 
26 
27 #ifndef _LOGGER_H
28 #define _LOGGER_H
29 
30 #include "sP2PBase.h"
31 #include <string>
32 #include <sstream>
33 #include <list>
34 #include "Event.h"
35 
36 namespace sp2plib{
37 
38 class SP2P_API Logger{
39 public:
40 
43  static ::std::string log_file;
44 
45 
50  static int WriteLogEntry(sP2PBase *sender, ::std::string Text);
51 
52 
57  static int WriteLogEntry(::std::string sender, ::std::string Text);
58 
59  /*static void* AddWriteLogHandler(void(*handler)(::std::string));
60  static void* RemoveWriteLogHandler(void(*handler)(::std::string));*/
61 
63  static void Activate();
64 
66  static void Deactivate();
67 
69  static void Reset();
70 
72  static bool IsActive();
73 
75  static Event<const char*> &onLoggerWrite();
76 private:
77  static Event<const char*> _onLoggerWrite;
78  static ::std::ostringstream log;
79  //static ::std::list<void(*)(::std::string)> Handlers;
80  static bool _Active;
81 };
82 
83 }
84 
85 #endif