Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2024 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : *
19 : * @file ILogHandler.h
20 : *
21 : * This file comprises the class definition of ILogHandler.
22 : * An interface, which provides API of custom server manager logging handler
23 : */
24 :
25 : #ifndef FIREBOLT_RIALTO_I_CLIENT_LOG_HANDLER_H_
26 : #define FIREBOLT_RIALTO_I_CLIENT_LOG_HANDLER_H_
27 :
28 : /**
29 : * @file IClientLogHandler.h
30 : *
31 : * The definition of the IClientLogHandler interface.
32 : *
33 : * This interface allows the user to define their own log handler for
34 : * any messages generated by the rialto client library
35 : */
36 :
37 : #include <string>
38 :
39 : namespace firebolt::rialto
40 : {
41 : /**
42 : * @brief IClientLogHandler allows the user to define their own log handler for
43 : * any messages generated by the rialto client library
44 : */
45 : class IClientLogHandler
46 : {
47 : public:
48 4 : IClientLogHandler() = default;
49 4 : virtual ~IClientLogHandler() = default;
50 : IClientLogHandler(const IClientLogHandler &) = delete;
51 : IClientLogHandler &operator=(const IClientLogHandler &) = delete;
52 : IClientLogHandler(IClientLogHandler &&) = delete;
53 : IClientLogHandler &operator=(IClientLogHandler &&) = delete;
54 :
55 : /**
56 : * @brief All possible log levels that could be used in the log callback
57 : */
58 :
59 : enum class Level
60 : {
61 : Fatal,
62 : Error,
63 : Warning,
64 : Milestone,
65 : Info,
66 : Debug,
67 : External
68 : };
69 :
70 : /**
71 : * @brief A callback method for every log item generated by the rialto client library
72 : *
73 : * @param[in] level : The log level
74 : * @param[in] file : The source code file where the log is defined
75 : * @param[in] line : The line number within the file where the log is defined
76 : * @param[in] function : The source code function within which the log is defined
77 : * @param[in] message : The message of the log
78 : */
79 : virtual void log(Level level, const std::string &file, int line, const std::string &function,
80 : const std::string &message) = 0;
81 : };
82 : } // namespace firebolt::rialto
83 :
84 : #endif // FIREBOLT_RIALTO_I_CLIENT_LOG_HANDLER_H_
|