27#ifndef A11_ACTIONS_LOG_H_
28#define A11_ACTIONS_LOG_H_
35#include <absl/base/log_severity.h>
36#include <absl/status/statusor.h>
37#include <absl/time/time.h>
198 std::string_view action_name = {},
199 std::string_view action_id = {});
constexpr std::string_view kLogChildActionAttribute
Metadata attribute naming the nested action that wrote a log.
Definition log.h:99
constexpr std::string_view kLogInternalAttribute
Metadata attribute marking a log not meant for an end user.
Definition log.h:87
std::string_view LogLevelName(LogLevel level)
Canonical lowercase name of level, as written to a chunk.
Definition log.cc:78
constexpr std::string_view kLogInternalFalse
The value kLogInternalAttribute takes when it is not.
Definition log.h:107
constexpr std::string_view kLogLevelAttribute
Metadata attribute naming the log's level.
Definition log.h:80
std::function< void(const LogRecord &)> ActionLogSink
What the process does with a log it consumes itself.
Definition log.h:164
constexpr std::string_view kLogChannelAttribute
Metadata attribute naming the log's logical channel.
Definition log.h:93
std::string LogText(const LogRecord &record)
record as one line: its payload where that is text, a description of it where it is not.
Definition log.cc:172
void ReportLog(const LogRecord &record)
Reports record to the installed sink.
Definition log.cc:149
bool IsTextualLogMimetype(std::string_view mimetype)
Whether a log payload of mimetype reads as text.
Definition log.cc:162
constexpr LogLevel kDefaultLogLevel
The default level of a log written without one.
Definition log.h:58
absl::LogSeverity LogLevelToSeverity(LogLevel level)
The Abseil severity level is reported at.
Definition log.cc:119
constexpr std::string_view kLogFileAttribute
Metadata attribute naming the source file the log came from.
Definition log.h:95
constexpr std::string_view kLogChildCallIdAttribute
Metadata attribute naming the nested action call that wrote a log.
Definition log.h:101
absl::StatusOr< LogLevel > ParseLogLevel(std::string_view name)
Parses a level name.
Definition log.cc:94
constexpr std::string_view kLogInternalTrue
The value kLogInternalAttribute takes when the log is internal.
Definition log.h:105
void SetActionLogSink(ActionLogSink sink)
Installs sink as the process's action log sink.
Definition log.cc:134
ActionLogSink GetActionLogSink()
Returns the installed sink; never null.
Definition log.cc:139
LogRecord LogRecordFromChunk(const data::Chunk &chunk, std::string_view action_name, std::string_view action_id)
Reads a LogRecord back out of a log chunk.
Definition log.cc:180
constexpr std::string_view kLogLinenoAttribute
Metadata attribute naming the source line the log came from.
Definition log.h:97
LogLevel
Severity of a log chunk.
Definition log.h:49
absl::flat_hash_map< std::string, Bytes > ByteMap
String-keyed map of byte values (headers, attributes, etc.).
Definition types.h:58
std::string mimetype
Definition sqlite_chunk_store.cc:191
Everything about a log other than the object being logged.
Definition log.h:115
std::string_view channel
Logical channel; see kLogChannelAttribute.
Definition log.h:126
const data::ByteMap *absl_nullable metadata
Extra attributes, merged before the fields above. Not owned.
Definition log.h:134
std::string_view level
Level name; empty is kDefaultLogLevel. See ParseLogLevel.
Definition log.h:117
bool internal
Whether this log is A11's own bookkeeping; see kLogInternalAttribute.
Definition log.h:132
std::string_view mimetype
Media type hint for the serializer.
Definition log.h:124
std::string_view file
Source file the log came from; see kLogFileAttribute.
Definition log.h:128
std::optional< int > lineno
Source line the log came from; see kLogLinenoAttribute.
Definition log.h:130
One log as a sink sees it.
Definition log.h:143
std::string_view channel
Definition log.h:147
std::string_view data
The chunk's payload as written.
Definition log.h:155
std::string_view action_name
Definition log.h:144
absl::Time timestamp
Definition log.h:151
std::string_view file
Definition log.h:148
std::string_view mimetype
Definition log.h:152
LogLevel level
Definition log.h:146
bool internal
Definition log.h:150
std::string_view action_id
Definition log.h:145
std::optional< int > lineno
Definition log.h:149
A unit of data: bytes plus optional descriptive metadata.
Definition types.h:185
A11's core wire value types: chunks, node fragments and messages.