Visual Computing Library
Loading...
Searching...
No Matches
abstract_logger.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_MISC_LOGGER_ABSTRACT_LOGGER_H
24#define VCL_MISC_LOGGER_ABSTRACT_LOGGER_H
25
26#include <vclib/concepts/logger.h>
27
28#include <string>
29
30namespace vcl {
31
39{
40public:
41 // note: these constants have the _LOG suffix to avoid conflicts with some
42 // macros defined in windows.h headers
43 enum LogLevel {
44 ERROR_LOG = 0,
45 WARNING_LOG,
46 MESSAGE_LOG,
47 PROGRESS_LOG,
48 DEBUG_LOG
49 };
50
51 AbstractLogger() = default;
52
53 virtual void enableIndentation() = 0;
54
55 virtual void disableIndentation() = 0;
56
57 virtual void enablePrintPercentage() = 0;
58
59 virtual void disablePrintPercentage() = 0;
60
73 virtual void setPrintLevel(LogLevel level) = 0;
74
75 virtual void enablePrintMessageDuringProgress() = 0;
76
77 virtual void disablePrintMessageDuringProgress() = 0;
78
79 virtual void enablePrintTimer() = 0;
80
81 virtual void disablePrintTimer() = 0;
82
83 virtual void reset() = 0;
84
85 virtual void setMaxLineWidth(uint width) = 0;
86
87 virtual void startTimer() = 0;
88
89 virtual void stopTimer() = 0;
90
98 virtual double time() const = 0;
99
100 virtual void startNewTask(
101 double fromPerc,
102 double toPerc,
103 const std::string& action) = 0;
104
105 virtual void endTask(const std::string& action) = 0;
106
107 virtual double percentage() const = 0;
108
109 virtual void setPercentage(uint newPerc) = 0;
110
117 virtual void log(const std::string& msg) const = 0;
118
126 virtual void log(const std::string& msg, LogLevel lvl) const = 0;
127
135 virtual void log(uint perc, const std::string& msg) = 0;
136
145 virtual void log(uint perc, const std::string& msg, LogLevel lvl) = 0;
146
179 virtual void startProgress(
180 const std::string& msg,
181 uint progressSize,
182 uint percPrintProgress = 10,
183 uint startPerc = 0,
184 uint endPerc = 100) = 0;
185
209 virtual void endProgress() = 0;
210
240 virtual void progress(uint n) = 0;
241};
242
243} // namespace vcl
244
245#endif // VCL_MISC_LOGGER_ABSTRACT_LOGGER_H
The AbstractLogger class is used as common ancestor class for all the logger types in the library.
Definition abstract_logger.h:39
virtual void log(const std::string &msg) const =0
Prints a message to the logger, with level LogLevel::PROGRESS and without modifying the current perce...
virtual double time() const =0
Returns the time passed since the last call to startTimer member function, or the time passed between...
virtual void endProgress()=0
Allows to easily manage progresses with the logger, along with the startProgress and progress member ...
virtual void startProgress(const std::string &msg, uint progressSize, uint percPrintProgress=10, uint startPerc=0, uint endPerc=100)=0
Allows to easily manage progresses with the logger, along with the progress and endProgress member fu...
virtual void setPrintLevel(LogLevel level)=0
Sets the maximum print level of the logger.
virtual void log(const std::string &msg, LogLevel lvl) const =0
Prints a message to the logger, with the given level and without modifying the current percentage.
virtual void progress(uint n)=0
Allows to easily manage progresses with the logger, along with the startProgress and endProgress memb...
virtual void log(uint perc, const std::string &msg, LogLevel lvl)=0
Prints a message to the logger, with the given level and with the given percentage.
virtual void log(uint perc, const std::string &msg)=0
Prints a message to the logger, with the level LogLevel::PROGRESS and with the given percentage.
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43