OpenShot Library | libopenshot
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
Logger.h
Go to the documentation of this file.
1
// Copyright (c) 2008-2026 OpenShot Studios, LLC
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
#ifndef OPENSHOT_LOGGER_H
4
#define OPENSHOT_LOGGER_H
5
6
#include <atomic>
7
#include <fstream>
8
#include <mutex>
9
#include <string>
10
11
namespace
openshot
{
12
class
Settings
;
14
class
Logger {
15
public
:
16
enum
Level
{
LevelDebug
= 10,
LevelInfo
= 20,
LevelWarning
= 30,
LevelError
= 40,
LevelCritical
= 50,
LevelOff
= 100 };
17
static
Logger
*
Instance
();
19
void
SetFileLevel
(std::string level);
20
void
SetConsoleLevel
(std::string level);
21
bool
ShouldLog
(
Level
level =
LevelDebug
)
const
;
22
void
Path
(std::string
path
);
23
void
Close
();
24
void
Log
(std::string message,
Level
level =
LevelDebug
);
26
void
LogToFile
(std::string message);
28
void
Enable
(
bool
enabled);
30
void
Connection
(std::string connection) {}
31
void
AppendDebugMethod
(std::string method_name,
32
std::string arg1_name=
""
,
float
arg1_value=-1.0,
33
std::string arg2_name=
""
,
float
arg2_value=-1.0,
34
std::string arg3_name=
""
,
float
arg3_value=-1.0,
35
std::string arg4_name=
""
,
float
arg4_value=-1.0,
36
std::string arg5_name=
""
,
float
arg5_value=-1.0,
37
std::string arg6_name=
""
,
float
arg6_value=-1.0);
38
private
:
39
Logger
();
40
Settings
* legacy_settings;
41
Logger
(
const
Logger
&) =
delete
;
42
Logger
& operator=(
const
Logger
&) =
delete
;
43
std::recursive_mutex loggerMutex;
44
std::ofstream log_file;
45
std::string file_path;
46
std::atomic<int> file_level{
LevelInfo
};
47
std::atomic<int> console_level{
LevelInfo
};
48
std::atomic<bool> file_open{
false
};
49
std::atomic<bool> console_configured{
false
};
50
int
ConsoleLevel()
const
;
51
};
52
}
53
#endif
path
path
Definition
FFmpegWriter.cpp:1973
openshot::Logger
Independent file and stderr logging. No networking or worker thread.
Definition
Logger.h:14
openshot::Logger::Level
Level
Definition
Logger.h:16
openshot::Logger::LevelCritical
@ LevelCritical
Definition
Logger.h:16
openshot::Logger::LevelDebug
@ LevelDebug
Definition
Logger.h:16
openshot::Logger::LevelError
@ LevelError
Definition
Logger.h:16
openshot::Logger::LevelWarning
@ LevelWarning
Definition
Logger.h:16
openshot::Logger::LevelOff
@ LevelOff
Definition
Logger.h:16
openshot::Logger::LevelInfo
@ LevelInfo
Definition
Logger.h:16
openshot::Logger::AppendDebugMethod
void AppendDebugMethod(std::string method_name, std::string arg1_name="", float arg1_value=-1.0, std::string arg2_name="", float arg2_value=-1.0, std::string arg3_name="", float arg3_value=-1.0, std::string arg4_name="", float arg4_value=-1.0, std::string arg5_name="", float arg5_value=-1.0, std::string arg6_name="", float arg6_value=-1.0)
Definition
Logger.cpp:168
openshot::Logger::SetFileLevel
void SetFileLevel(std::string level)
Explicit configuration overrides environment defaults. Invalid levels throw.
Definition
Logger.cpp:104
openshot::Logger::SetConsoleLevel
void SetConsoleLevel(std::string level)
Definition
Logger.cpp:105
openshot::Logger::Path
void Path(std::string path)
Definition
Logger.cpp:111
openshot::Logger::Connection
void Connection(std::string connection)
Deprecated compatibility no-op; logging no longer uses connections.
Definition
Logger.h:30
openshot::Logger::Enable
void Enable(bool enabled)
Compatibility: enable debug file output, or disable ordinary file output.
Definition
Logger.cpp:109
openshot::Logger::ShouldLog
bool ShouldLog(Level level=LevelDebug) const
Definition
Logger.cpp:101
openshot::Logger::Close
void Close()
Definition
Logger.cpp:158
openshot::Logger::LogToFile
void LogToFile(std::string message)
Unfiltered raw output, retained for the existing crash handler.
Definition
Logger.cpp:142
openshot::Logger::Log
void Log(std::string message, Level level=LevelDebug)
Definition
Logger.cpp:146
openshot::Logger::Instance
static Logger * Instance()
Definition
Logger.cpp:55
openshot::Settings
This class is contains settings used by libopenshot (and can be safely toggled at any point).
Definition
Settings.h:26
openshot
This namespace is the default namespace for all code in the openshot library.
Definition
AnimatedCurve.h:24
Logger.h
Generated by
1.17.0