| 15747 |
anikendra |
1 |
/*
|
|
|
2 |
* Copyright (c) 2013 BlackBerry Limited
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13 |
* See the License for the specific language governing permissions and
|
|
|
14 |
* limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
#ifndef LOGGER_HPP_
|
|
|
18 |
#define LOGGER_HPP_
|
|
|
19 |
|
|
|
20 |
#include <string>
|
|
|
21 |
#include <slog2.h>
|
|
|
22 |
|
|
|
23 |
class Keyboard_JS;
|
|
|
24 |
|
|
|
25 |
namespace webworks {
|
|
|
26 |
|
|
|
27 |
class Logger {
|
|
|
28 |
public:
|
|
|
29 |
explicit Logger(const char* name, Keyboard_JS *parent = NULL);
|
|
|
30 |
virtual ~Logger();
|
|
|
31 |
int debug(const char* message);
|
|
|
32 |
int info(const char* message);
|
|
|
33 |
int notice(const char* message);
|
|
|
34 |
int warn(const char* message);
|
|
|
35 |
int error(const char* message);
|
|
|
36 |
int critical(const char* message);
|
|
|
37 |
int setVerbosity(_Uint8t verbosity);
|
|
|
38 |
_Uint8t getVerbosity();
|
|
|
39 |
slog2_buffer_t hiPriorityBuffer();
|
|
|
40 |
slog2_buffer_t lowPriorityBuffer();
|
|
|
41 |
private:
|
|
|
42 |
Keyboard_JS *m_pParent;
|
|
|
43 |
slog2_buffer_set_config_t buffer_config;
|
|
|
44 |
slog2_buffer_t buffer_handle[2];
|
|
|
45 |
int log(slog2_buffer_t buffer, _Uint8t severity, const char* message);
|
|
|
46 |
};
|
|
|
47 |
|
|
|
48 |
} /* namespace webworks */
|
|
|
49 |
#endif /* LOGGER_HPP_ */
|