File: main.cpp

package info (click to toggle)
plog 1.1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,404 kB
  • sloc: cpp: 13,637; ansic: 473; sh: 24; makefile: 4
file content (44 lines) | stat: -rw-r--r-- 997 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// FreeRTOS includes
#include <FreeRTOS.h>
#include <task.h>

// PLOG includes
#include <plog/Log.h>
#include <plog/Init.h>
#include <plog/Formatters/TxtFormatter.h>
#include <plog/Appenders/ColorConsoleAppender.h>

static void exampleTask(void* /*parameter*/)
{
    for (;;)
    {
        PLOGI << "tick";
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}

int main()
{
    static plog::ColorConsoleAppender<plog::TxtFormatter> appender;
    plog::init(plog::verbose, &appender);

    PLOG_VERBOSE << "verbose";
    PLOG_DEBUG << "debug";
    PLOG_INFO << "info";
    PLOG_WARNING << "warning";
    PLOG_ERROR << "error";
    PLOG_FATAL << "fatal";

    xTaskCreate(exampleTask, "example1", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1U, NULL);
    xTaskCreate(exampleTask, "example2", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1U, NULL);

    // Start the scheduler
    vTaskStartScheduler();

    // Should not reach here
    for (;;)
    {
    }

    return 0;
}