class Log
Defined at line 21 of file ../../zircon/kernel/phys/log.h
The Log is a FILE-compatible object that accumulates output in a contiguous
buffer of whole pages suitable for later handoff. It can optionally take
over as stdout, mirroring everything to the previous stdout before writing
it to the log. Page allocation failures cause a panic, which always resets
to the original stdout first when the Log is currently stdout.
Public Methods
int Write (ktl::string_view str)
This mirrors to the console (first) if SetStdout() has been used,
then appends to the log.
Defined at line 15 of file ../../zircon/kernel/phys/log.cc
void AppendToLog (ktl::string_view str)
This only appends to the log without mirroring to the console.
Defined at line 40 of file ../../zircon/kernel/phys/log.cc
FILE LogOnlyFile ()
Returns a FILE that calls AppendToLog instead of Write.
Defined at line 70 of file ../../zircon/kernel/phys/log.cc
FILE VerboseOnlyFile ()
Returns a FILE that acts either like Write or like LogOnlyFile,
depending on the kernel.phys.verbose boot option.
Defined at line 78 of file ../../zircon/kernel/phys/log.cc
void SetStdout ()
Replace the FILE::stdout_ object with this one, storing the previous
stdout object and mirroring the output to that one.
Defined at line 26 of file ../../zircon/kernel/phys/log.cc
void RestoreStdout ()
If this object was previously installed with SetStdout(), then restore the
original stdout that it replaced. If not, this is a harmless no-op.
Defined at line 33 of file ../../zircon/kernel/phys/log.cc
void ~Log ()
When the object dies, it always detaches from stdout.
Defined at line 46 of file ../../zircon/kernel/phys/log.h
size_t size_bytes ()
This can be used to track the current total size of the accumulated log.
Defined at line 49 of file ../../zircon/kernel/phys/log.h
bool empty ()
Defined at line 51 of file ../../zircon/kernel/phys/log.h
Allocation TakeBuffer ()
This takes ownership of the log's contiguous pages. After this, no other
methods can be used. In particular, size_bytes() should be taken first to
get the exact content size rather than the page-rounded buffer size.
Defined at line 56 of file ../../zircon/kernel/phys/log.h
ktl::string_view BorrowSnapshot ()
This borrows a snapshot of the accumulated log text. **NOTE!** The view
returned here must be used and discarded before anything might append to
the log in any fashion, which many paths can do indirectly.
Defined at line 65 of file ../../zircon/kernel/phys/log.h