Commit Graph

23 Commits

Author SHA1 Message Date
Tom
038dd9f30e AK: Serialize entire log statements
Prior to this, we wrote to the log every time the << operator
was used, which meant that only these parts of the log statement
were serialized. If the thread was preempted, or especially with
multiple CPUs the debug output was hard to decipher. Instead, we
buffer up the log statements. To avoid allocations we'll attempt
to use stack space, which covers most log statements.
2020-07-03 19:32:34 +02:00
Andreas Kling
21d5f4ada1 Kernel: Absorb LibBareMetal back into the kernel
This was supposed to be the foundation for some kind of pre-kernel
environment, but nobody is working on it right now, so let's move
everything back into the kernel and remove all the confusion.
2020-05-16 12:00:04 +02:00
Devashish Jaiswal
cc01933840
AK: Declare LogStream::operator<<(const LogStream&, long) (#2155)
LogStream::operator<<(const LogStream&, long) was implemented in
AK/LogStream.cpp but the declaration was missing from the header.
2020-05-08 09:35:23 +02:00
Andreas Kling
3bbc2c7300 AK: Add LogStream operator<< overloads for float and double 2020-04-12 19:23:39 +02:00
Andreas Kling
0d48fb9a87 AK: Add out() and warn() streams that forward to stdout and stderr
Our C++ code generator tools have been relying on host-side dbg() being
forwarded to stdout until now. Now they use out() instead.

Hopefully this will make it easier and more enticing to use streams in
userspace programs as well. :^)
2020-04-06 10:49:27 +02:00
Andreas Kling
c4a6d6ae9f AK: Add FlyString::to_lowercase() and LogStream operator<<(FlyString) 2020-03-22 19:07:02 +01:00
Andreas Kling
783c99516a AK: LogStream should handle being passed a null const char* 2020-03-04 21:04:06 +01:00
Liav A
9440c45d6e AK: Add support for Kernel Log Stream 2020-03-02 22:23:39 +01:00
Andreas Kling
3bbf4610d2 AK: Add a forward declaration header
You can now #include <AK/Forward.h> to get most of the AK types as
forward declarations.

Header dependency explosion is one of the main contributors to compile
times at the moment, so this is a step towards smaller include graphs.
2020-02-14 23:31:18 +01:00
Liav A
8bdb08c354 AK: Apply changes for the Bootstrapper environment 2020-02-09 19:38:17 +01:00
Andreas Kling
be0034d2ca AK: Break LogStream::operator<< overloads into i/l/ll and u/ul/ull 2020-02-05 19:13:44 +01:00
joshua stein
dc93ed4368 AK: Add support for 64-bit size_t 2020-02-05 18:39:45 +01:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling
44bc4008b7 Build: Get rid of the USERLAND define
Let's simplify things. There is now only KERNEL.
To see if you're on Serenity, check if __serenity__ is defined.
2019-12-20 22:59:11 +01:00
Andreas Kling
1726c17d0d AK: Handle LogStream operator<<(size_t)
This has been an annoyingly missing feature for some time.
2019-12-09 17:51:21 +01:00
Andreas Kling
2ad0ec325a AK: Get rid of TStyle (output styling helper for LogStream)
This didn't end up getting used, so let's get rid of it.
2019-11-06 11:37:03 +01:00
Andreas Kling
5122caf9a8 LogStream: Prefix userspace dbg() output with "ProcessName(PID): "
Using the new get_process_name() syscall, we can automatically prefix
all userspace debug logging.

Hopefully this is more helpful than annoying. We'll find out! :^)
2019-08-15 20:55:45 +02:00
Andreas Kling
9fb2a65716 AK: Rename ValueRestorer => ScopedValueRollback.
Qt had a pretty good name for this concept, so let's steal it. :^)
2019-07-25 15:15:46 +02:00
Andreas Kling
0846986cac LogStream: Preserve errno for the lifetime of a LogStream object. 2019-07-25 07:00:33 +02:00
Andreas Kling
af81645a2a Kernel+LibC: Add a dbgputstr() syscall for sending strings to debug output.
This is very handy for the DebugLogStream implementation, among others. :^)
2019-07-21 21:43:37 +02:00
Andreas Kling
8075ba5064 LogStream: Add a simple-ish mechanism for colorizing and styling output.
Meet TStyle. It allows you to write things like this:

    dbg() << TStyle(TStyle::Red, TStyle::Bold) << "Hello, friends!";

Any style used will be reset along with the newline emitted when the dbg()
temporary goes out of scope. :^)

This can definitely be improved, but I think it's a decent place to start.
2019-07-15 20:22:30 +02:00
Andreas Kling
1b013ba699 AK: Move some of LogStream out of line & add overloads for smart pointers. 2019-07-04 07:05:58 +02:00
Andreas Kling
05cc59921a AK: Start fleshing out LogStream, a type-aware logging mechanism.
The first implementation class is DebugLogStream, which can be used like so:

    dbg() << "Hello friends, I am " << m_years << " years old!";

Note that it will automatically print a newline when the object created by
dbg() goes out of scope.

This API will grow and evolve, so let's see what we end up with :^)
2019-07-04 06:43:30 +02:00