/log-viewer

:hammer: Solution to receive log and debug messages from applications that do not have access to standard input and output. Like Linux Daemons, fork() processes and any similar application. Messages are sent through Non-Blocking Socket, and received in an Electron application.

Primary LanguageCBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause




Language: PT-BR

When you're implementing things like Linux Daemons, or any application where you don't have access to the standard IO, it's nice to have an application to receive messages from your program.

This is exactly what this application does, it connects to a TCP server on port 1337 (you can edit the port and destination IP address in the file example/debug.h).

In order not to crash the application when sending messages, Non-Blocking Socket techniques are used.

If my code has helped you, please consider sponsoring me 💙


💻 Usage example

Just add the debug.h header in your application, and use it as shown in the code below.


#include "debug.h"

int main (int argc, char *argv[])
{
    /**
     * Detailed message example.
     */
    say_debug_detail("Iesus Hominum Salvator!");

    /**
     * Example of common usage.
     */
    
    for (int a=0; a<10; a++) {
        say_debug("Message %d: Iesus Hominum Salvator!", a);
        sleep(1);
    }

    return 0;
}

To use the message visualization application (as shown in the image above), just open it using Electron. Remembering that the Electron version used is 19.0.0, and you can find it here: https://github.com/electron/electron/releases/tag/v19.0.0

All you need to do is run Electron, and specify the application directory in its parameters.

electron .

😃 Author

Sponsor: melchisedech333
Twitter: Melchisedech333
LinkedIn: Melchisedech Rex
Blog: melchisedech333.github.io


📜 License

BSD-3-Clause license



Remember to give me
a beautiful little star 🤩