Skyld AV  0.6
On access virus scanning for Linux
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Messaging.h
Go to the documentation of this file.
1 /*
2  * File: Messaging.h
3  *
4  * Copyright 2013 Heinrich Schuchardt <xypron.glpk@gmx.de>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 
25 #include <fstream>
26 #include <string>
27 #include <syslog.h>
28 
29 #ifndef MESSAGING_H
30 #define MESSAGING_H
31 
35 class Messaging {
36 public:
40  enum Level {
44  DEBUG = 1,
52  WARNING = 3,
56  ERROR = 4
57  };
58 
59  static void setLevel(const enum Level);
60  static void error(const std::string&);
61  static void message(const enum Level, const std::string&);
62  static void teardown();
63 private:
65  std::fstream logfs;
67 
68  Messaging();
69  ~Messaging();
70  static Messaging *getSingleton();
71 };
72 
73 #endif /* MESSAGING_H */
74 
static void teardown()
Deletes the singleton.
Definition: Messaging.cc:167
static void setLevel(const enum Level)
Sets message level.
Definition: Messaging.cc:149
Error, e.g. malfunction of the code, malware detected.
Definition: Messaging.h:56
Messaging()
Creates the singleton.
Definition: Messaging.cc:46
static void error(const std::string &)
Sends an error message based on errno.
Definition: Messaging.cc:88
std::fstream logfs
Definition: Messaging.h:65
~Messaging()
Deletes singleton.
Definition: Messaging.cc:177
Warning, e.g. file access has been blocked.
Definition: Messaging.h:52
Information, e.g. access scanning has started.
Definition: Messaging.h:48
Outputs messages to system and application log and to the console.
Definition: Messaging.h:35
static void message(const enum Level, const std::string &)
Sends message.
Definition: Messaging.cc:101
enum Level messageLevel
Definition: Messaging.h:66
static Messaging * singleton
Singleton responsible for all messages sent.
Definition: Messaging.h:64
Debugging information only to be shown in the console.
Definition: Messaging.h:44
Level
Message levels available.
Definition: Messaging.h:40
static Messaging * getSingleton()
Retrieves the messaging singleton.
Definition: Messaging.cc:157