ProfinetConnector/profinet_test/sample_app/app_log.c
svad05 c9fe825657 dev(UML-981): Автоматизация сборки
1. Добавил скрипт build.sh - собирает библиотеку pnet и группирует
получившиеся файлы в папку install, туда же помещает библиотеку osal.
Теперь все библиотеки и их заголовки в одном месте, а не распизаны по
папкам в папке build.
2. Добавил проект sample_app в папку profinet_test. Он отвязан от
процесса сборки pnet и использует уже собранную библиотеку из папки
install.
2022-07-12 15:59:03 +02:00

53 lines
1.2 KiB
C

/*********************************************************************
* _ _ _
* _ __ | |_ _ | | __ _ | |__ ___
* | '__|| __|(_)| | / _` || '_ \ / __|
* | | | |_ _ | || (_| || |_) |\__ \
* |_| \__|(_)|_| \__,_||_.__/ |___/
*
* www.rt-labs.com
* Copyright 2021 rt-labs AB, Sweden.
*
* This software is dual-licensed under GPLv3 and a commercial
* license. See the file LICENSE.md distributed with this software for
* full license information.
********************************************************************/
#include "app_log.h"
#include <stdarg.h>
#include <stdio.h>
static int32_t log_level = APP_DEFAULT_LOG_LEVEL;
void app_log_set_log_level (int32_t level)
{
log_level = level;
}
void app_log (int32_t level, const char * fmt, ...)
{
va_list list;
if (level >= log_level)
{
va_start (list, fmt);
vprintf (fmt, list);
va_end (list);
fflush (stdout);
}
}
void app_log_print_bytes (int32_t level, const uint8_t * bytes, uint32_t len)
{
if (level >= log_level)
{
printf (" Bytes: ");
for (uint32_t i = 0; i < len; i++)
{
printf ("%02X ", bytes[i]);
}
printf ("\n");
}
}