1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00
systemd-stable/docs
Daan De Meyer 7c7a9138a2 basic: Add log context
This commit adds support for attaching extra metadata to log
messages written to the journal via log.h. We keep track of a
thread local log context in log.c onto which we can push extra
metadata fields that should be logged. Once a field is no longer
relevant, it can be popped again from the log context.

On top of this, we then add macros to allow pushing extra fields
onto the log context.

LOG_CONTEXT_PUSH() will push the provided field onto the log context
and pop the last field from the log context when the current block
ends. LOG_CONTEXT_PUSH_STRV() will do the same but for all fields in
the given strv.

Using the macros is as simple as putting them anywhere inside a block
to add a field to all following log messages logged from inside that
block.

void myfunction(...) {
	...

	LOG_CONTEXT_PUSH("MYMETADATA=abc");

	// Every journal message logged will now have the MYMETADATA=abc
        // field included.
}

For convenience, there's also LOG_CONTEXT_PUSHF() to allow constructing
the field to be logged using printf() syntax.

log_context_new()/log_context_free() can be used to attach a log context
to an async operation by storing it in the associated userdata struct.
2023-01-08 16:31:16 +01:00
..
_data docs: beef up entrypoint documentation page 2019-12-11 10:53:14 +01:00
_includes docs: add dark mode 2022-05-17 23:00:18 +02:00
_layouts docs: adapt forward layout to systemd.io design 2022-05-21 18:09:50 +02:00
assets docs: add dark mode 2022-05-17 23:00:18 +02:00
fonts docs: make it pretty 2019-12-11 17:04:20 +01:00
sysvinit meson: also allow setting GIT_VERSION via templates 2022-04-05 22:18:31 +02:00
var-log docs: move /var/log/README to a tmpfiles.d symlink 2021-07-21 17:29:06 +02:00
_config.yml docs: use https:// for fd.o links 2022-01-12 16:05:59 +01:00
.gitattributes docs: mark spdx headers with the default license to website files 2021-10-18 09:43:18 +02:00
.gitignore gitignore: add jekyll cache directory 2021-06-24 10:20:29 +02:00
ARCHITECTURE.md doc: drop remaining references to LGTM.com 2022-09-23 18:29:22 +09:00
AUTOMATIC_BOOT_ASSESSMENT.md tree-wide: BLS and DPS are now on uapi-group website 2022-11-21 12:26:35 +01:00
BLOCK_DEVICE_LOCKING.md tree-wide: use -EBADF for fd initialization 2022-12-19 15:00:57 +01:00
BOOT_LOADER_INTERFACE.md Merge pull request #25379 from keszybz/update-doc-links 2022-11-22 01:07:13 +01:00
BOOT_LOADER_SPECIFICATION.md docs: DPS and BLS have moved to uapi-group.org 2022-11-02 07:31:18 +09:00
BUILDING_IMAGES.md tree-wide: BLS and DPS are now on uapi-group website 2022-11-21 12:26:35 +01:00
CGROUP_DELEGATION.md tree-wide: link to docs.kernel.org for kernel documentation 2022-07-04 19:56:53 +02:00
CODE_OF_CONDUCT.md docs: add spdx tags to all .md files 2021-09-27 09:19:02 +02:00
CODE_QUALITY.md doc: drop remaining references to LGTM.com 2022-09-23 18:29:22 +09:00
CODING_STYLE.md CODING_STYLE: fix 'better' typo 2023-01-06 14:03:19 +01:00
CONTAINER_INTERFACE.md docs: remove /dev/tty* confusion 2022-12-23 21:17:31 +01:00
CONTRIBUTING.md ci: Labeler improvements 2022-12-09 15:37:43 +01:00
CONVERTING_TO_HOMED.md Use https for man7.org 2022-06-28 16:05:31 +02:00
COREDUMP_PACKAGE_METADATA.md docs: rename COREDUMP_PACKAGE_METADATA → ELF_PACKAGE_METADATA 2022-05-21 18:08:19 +02:00
CREDENTIALS.md creds: import 'vmm.notify_socket' and use it to set 2023-01-05 23:07:16 +01:00
DESKTOP_ENVIRONMENTS.md docs: fix typo in key name and adjust grammar a bit 2022-01-10 13:22:48 +01:00
DISCOVERABLE_PARTITIONS.md docs: DPS and BLS have moved to uapi-group.org 2022-11-02 07:31:18 +09:00
DISTRO_PORTING.md docs: add spdx tags to all .md files 2021-09-27 09:19:02 +02:00
ELF_PACKAGE_METADATA.md docs: rename COREDUMP_PACKAGE_METADATA → ELF_PACKAGE_METADATA 2022-05-21 18:08:19 +02:00
ENVIRONMENT.md basic: Add log context 2023-01-08 16:31:16 +01:00
favicon.png docs: make it pretty 2019-12-11 17:04:20 +01:00
favicon.svg docs: mark spdx headers with the default license to website files 2021-10-18 09:43:18 +02:00
GROUP_RECORD.md docs: use relative links 2022-05-18 20:34:10 +02:00
HACKING.md docs/HACKING.md: clarify some portions 2022-10-31 20:56:37 +01:00
HOME_DIRECTORY.md docs: use relative links 2022-05-18 20:34:10 +02:00
index.md docs: overhaul styling for example log messages on startpage 2022-05-17 23:00:18 +02:00
INITRD_INTERFACE.md tree-wide: use mode=0nnn for mount option 2022-12-14 22:12:44 +01:00
JOURNAL_EXPORT_FORMATS.md docs: streamline headline structure in JOURNAL_EXPORT_FORMATS.md 2022-05-18 20:34:10 +02:00
JOURNAL_FILE_FORMAT.md journal: Store offsets to tail entry array objects in chain 2022-10-07 12:28:09 +02:00
JOURNAL_NATIVE_PROTOCOL.md docs: s/straight-forward/straightforward/ 2022-03-15 22:46:09 +00:00
NETWORK_ONLINE.md docs/NETWORK_ONLINE: systemd.network hyperlink fix 2022-09-28 15:48:39 +09:00
PASSWORD_AGENTS.md Use https for man7.org 2022-06-28 16:05:31 +02:00
PORTABILITY_AND_STABILITY.md tree-wide: replace obsolete wiki links with systemd.io/manpages 2022-05-21 14:29:14 +02:00
PORTABLE_SERVICES.md repart: support erofs 2022-12-10 11:26:36 +01:00
PORTING_TO_NEW_ARCHITECTURES.md tree-wide: BLS and DPS are now on uapi-group website 2022-11-21 12:26:35 +01:00
PREDICTABLE_INTERFACE_NAMES.md docs: move some stuff into "Networking" section 2022-07-05 11:22:06 +01:00
RANDOM_SEEDS.md boot: remove random-seed-mode 2022-11-22 01:30:03 +01:00
RELEASE.md docs: update translation strings before new release 2022-10-20 10:39:03 +02:00
RESOLVED-VPNS.md docs: avoid multiple first-level headlines 2022-05-17 23:00:18 +02:00
ROOT_STORAGE_DAEMONS.md tree-wide: also settle on "initrd" instead of "initial RAM disk" 2022-09-23 15:12:18 +02:00
SECURITY.md docs: add spdx tags to all .md files 2021-09-27 09:19:02 +02:00
style.css docs: desaturate dark-mode background color 2022-06-10 13:52:31 +02:00
TEMPORARY_DIRECTORIES.md Use https for man7.org 2022-06-28 16:05:31 +02:00
TESTING_WITH_SANITIZERS.md mkosi: Changes to allow booting with sanitizers in mkosi 2022-07-18 16:54:56 +02:00
TRANSIENT-SETTINGS.md journal: log filtering options support in PID1 2022-12-15 09:57:39 +00:00
TRANSLATORS.md docs: replace <pre>, <code> and <tt> tags by backticks 2022-05-17 22:35:54 +02:00
UIDS-GIDS.md tree-wide: also settle on "initrd" instead of "initial RAM disk" 2022-09-23 15:12:18 +02:00
USER_GROUP_API.md Use https for man7.org 2022-06-28 16:05:31 +02:00
USER_NAMES.md docs: s/straight-forward/straightforward/ 2022-03-15 22:46:09 +00:00
USER_RECORD.md Implement --luks-pbkdf-force-iterations for homed 2022-12-06 15:56:11 +01:00
USERDB_AND_DESKTOPS.md docs: use relative links 2022-05-18 20:34:10 +02:00