![]() |
ArkScript
A small, lisp-inspired, functional scripting language
|
#include <Logger.hpp>
Classes | |
| struct | MessageAndLocation |
Public Member Functions | |
| Logger (std::string name, unsigned debug_level) | |
| Construct a new Logger object. | |
| unsigned | debugLevel () const |
| bool | shouldInfo () const |
| bool | shouldDebug () const |
| bool | shouldTrace () const |
| template<typename... Args> | |
| void | info (const char *fmt, Args &&... args) |
| Write an info level log using fmtlib. | |
| template<typename... Args> | |
| void | warn (const char *fmt, Args &&... args) |
| Write a warn level log using fmtlib. | |
| template<typename... Args> | |
| void | debug (const Logger::MessageAndLocation &data, Args &&... args) |
| Write a debug level log using fmtlib. | |
| void | traceStart (std::string &&trace_name) |
| void | traceEnd () |
| template<typename... Args> | |
| void | trace (const char *fmt, Args &&... args) |
| Write a trace level log using fmtlib. | |
| void | configureOutputStream (std::ostream *os) |
| Set a custom output stream to use for warnings. This will disable colors. | |
| bool | colorize () const noexcept |
| Check if logs can be colorized. | |
Private Attributes | |
| unsigned | m_debug |
| std::string | m_name |
| fmt::color | m_pass_color |
| std::unordered_map< std::string, std::chrono::time_point< std::chrono::high_resolution_clock > > | m_trace_starts |
| std::vector< std::string > | m_active_traces |
| std::ostream * | m_stream |
Definition at line 27 of file Logger.hpp.
| Ark::internal::Logger::Logger | ( | std::string | name, |
| unsigned | debug_level ) |
Construct a new Logger object.
| name | the pass name, used for logging |
| debug_level | debug level |
Definition at line 29 of file Logger.cpp.
References Ark::internal::colors, m_name, and m_pass_color.
|
inlinenoexcept |
Check if logs can be colorized.
Definition at line 157 of file Logger.hpp.
Referenced by Ark::internal::ASTLowerer::warning().
|
inline |
Set a custom output stream to use for warnings. This will disable colors.
| os | output stream |
Definition at line 147 of file Logger.hpp.
Referenced by Ark::internal::Pass::configureLogger(), and Ark::Welder::redirectLogsTo().
|
inline |
Write a debug level log using fmtlib.
| Args |
| data | format string |
| args |
Definition at line 96 of file Logger.hpp.
References Ark::internal::Logger::MessageAndLocation::location, and Ark::internal::Logger::MessageAndLocation::message.
Referenced by Ark::internal::IROptimizer::IROptimizer(), Ark::internal::ImportSolver::process(), Ark::internal::MacroProcessor::process(), and Ark::internal::Optimizer::pruneUnusedGlobalVariables().
|
inlinenodiscard |
Definition at line 50 of file Logger.hpp.
|
inline |
Write an info level log using fmtlib.
| Args |
| fmt | format string |
| args |
Definition at line 63 of file Logger.hpp.
Referenced by Ark::Welder::saveBytecodeToFile().
|
inlinenodiscard |
Definition at line 53 of file Logger.hpp.
|
inlinenodiscard |
Definition at line 52 of file Logger.hpp.
|
inlinenodiscard |
Definition at line 54 of file Logger.hpp.
Referenced by Ark::internal::MacroProcessor::process(), Ark::internal::NameResolutionPass::process(), Ark::internal::Optimizer::process(), and Ark::internal::NameResolutionPass::updateSymbolWithFullyQualifiedName().
|
inline |
Write a trace level log using fmtlib.
| Args |
| fmt | format string |
| args |
Definition at line 132 of file Logger.hpp.
Referenced by Ark::internal::MacroProcessor::process(), Ark::internal::NameResolutionPass::process(), and Ark::internal::Optimizer::process().
|
inline |
Definition at line 115 of file Logger.hpp.
Referenced by Ark::internal::ImportSolver::parseImport(), Ark::internal::ASTLowerer::process(), Ark::internal::ImportSolver::process(), Ark::internal::IRCompiler::process(), Ark::internal::IROptimizer::process(), Ark::internal::MacroProcessor::process(), Ark::internal::NameResolutionPass::process(), Ark::internal::Optimizer::process(), and Ark::internal::Parser::process().
|
inline |
Definition at line 109 of file Logger.hpp.
Referenced by Ark::internal::ImportSolver::parseImport(), Ark::internal::ASTLowerer::process(), Ark::internal::ImportSolver::process(), Ark::internal::IRCompiler::process(), Ark::internal::IROptimizer::process(), Ark::internal::MacroProcessor::process(), Ark::internal::NameResolutionPass::process(), Ark::internal::Optimizer::process(), and Ark::internal::Parser::process().
|
inline |
Write a warn level log using fmtlib.
| Args |
| fmt | format string |
| args |
Definition at line 80 of file Logger.hpp.
Referenced by Ark::internal::Optimizer::pruneUnusedGlobalVariables(), Formatter::warnIfCommentsWereRemoved(), and Ark::internal::ASTLowerer::warning().
|
private |
Definition at line 167 of file Logger.hpp.
|
private |
Definition at line 163 of file Logger.hpp.
|
private |
Definition at line 164 of file Logger.hpp.
Referenced by Logger().
|
private |
Definition at line 165 of file Logger.hpp.
Referenced by Logger().
|
private |
Definition at line 168 of file Logger.hpp.
|
private |
Definition at line 166 of file Logger.hpp.