![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include "nix/util/error.hh"#include "nix/util/configuration.hh"#include "nix/util/file-descriptor.hh"#include "nix/util/finally.hh"#include "nix/util/fun.hh"#include <filesystem>#include <span>#include <type_traits>#include <nlohmann/json_fwd.hpp>Go to the source code of this file.
Classes | |
| class | nix::LoggerSettings |
| class | nix::Logger |
| struct | nix::Logger::Field |
| struct | nix::Logger::Suspension |
| struct | nix::Activity |
| struct | nix::PushActivity |
Macros | |
| #define | logErrorInfo(level, errorInfo...) |
| #define | logError(errorInfo...) |
| #define | logWarning(errorInfo...) |
| #define | printMsgUsing(loggerParam, level, args...) |
| #define | printMsg(level, args...) |
| #define | printError(args...) |
| #define | notice(args...) |
| #define | printInfo(args...) |
| #define | printTalkative(args...) |
| #define | debug(args...) |
| #define | vomit(args...) |
| #define | warnOnce(haveWarned, args...) |
Typedefs | |
| typedef uint64_t | nix::ActivityId |
Functions | |
| ActivityId | nix::getCurActivity () |
| void | nix::setCurActivity (const ActivityId activityId) |
| std::unique_ptr< Logger > | nix::makeSimpleLogger (bool printBuildLogs=true) |
| std::unique_ptr< Logger > | nix::makeTeeLogger (std::unique_ptr< Logger > mainLogger, std::vector< std::unique_ptr< Logger > > &&extraLoggers) |
| std::unique_ptr< Logger > | nix::makeJSONLogger (Descriptor fd, bool includeNixPrefix=true) |
| std::unique_ptr< Logger > | nix::makeJSONLogger (const std::filesystem::path &path, bool includeNixPrefix=true) |
| void | nix::applyJSONLogger () |
| std::optional< nlohmann::json > | nix::parseJSONMessage (std::string_view msg, std::string_view source) |
| bool | nix::handleJSONLogMessage (const nlohmann::json &json, const Activity &act, std::map< ActivityId, Activity > &activities, std::string_view source, bool trusted) |
| bool | nix::handleJSONLogMessage (std::string_view msg, const Activity &act, std::map< ActivityId, Activity > &activities, std::string_view source, bool trusted) |
| bool | nix::handleJSONLogMessage (const std::string &msg, const Activity &act, std::map< ActivityId, Activity > &activities, std::string_view source, bool trusted) |
| template<typename... Args> | |
| void | nix::warn (const std::string &fs, const Args &... args) |
| void | nix::writeToStderr (std::string_view s) noexcept |
Variables | |
| LoggerSettings | nix::loggerSettings |
| Logger * | nix::logger = makeSimpleLogger(true).release() |
| Verbosity | nix::verbosity = lvlInfo |
| #define debug | ( | args... | ) |
| #define logError | ( | errorInfo... | ) |
| #define logErrorInfo | ( | level, | |
| errorInfo... ) |
Print a message with the standard ErrorInfo format. In general, use these 'log' macros for reporting problems that may require user intervention or that need more explanation. Use the 'print' macros for more lightweight status messages.
| #define logWarning | ( | errorInfo... | ) |
| #define notice | ( | args... | ) |
| #define printError | ( | args... | ) |
| #define printInfo | ( | args... | ) |
| #define printMsg | ( | level, | |
| args... ) |
| #define printMsgUsing | ( | loggerParam, | |
| level, | |||
| args... ) |
Print a string message if the current log level is at least the specified level. Note that this has to be implemented as a macro to ensure that the arguments are evaluated lazily.
| #define printTalkative | ( | args... | ) |
| #define vomit | ( | args... | ) |
| #define warnOnce | ( | haveWarned, | |
| args... ) |
| bool nix::handleJSONLogMessage | ( | const nlohmann::json & | json, |
| const Activity & | act, | ||
| std::map< ActivityId, Activity > & | activities, | ||
| std::string_view | source, | ||
| bool | trusted ) |
| source | A noun phrase describing the source of the message, e.g. "the builder". |
| bool nix::handleJSONLogMessage | ( | std::string_view | msg, |
| const Activity & | act, | ||
| std::map< ActivityId, Activity > & | activities, | ||
| std::string_view | source, | ||
| bool | trusted ) |
| source | A noun phrase describing the source of the message, e.g. "the builder". |
| std::unique_ptr< Logger > nix::makeTeeLogger | ( | std::unique_ptr< Logger > | mainLogger, |
| std::vector< std::unique_ptr< Logger > > && | extraLoggers ) |
Create a logger that sends log messages to mainLogger and the list of loggers in extraLoggers. Only mainLogger is used for writing to stdout and getting user input.
| std::optional< nlohmann::json > nix::parseJSONMessage | ( | std::string_view | msg, |
| std::string_view | source ) |
| source | A noun phrase describing the source of the message, e.g. "the builder". |
|
inline |
if verbosity >= lvlWarn, print a message with a yellow 'warning:' prefix.
| Logger * nix::logger = makeSimpleLogger(true).release() |
This is a raw pointer to allow it to leak. Avoids races in activity teardown.
| Verbosity nix::verbosity = lvlInfo |
suppress msgs > this