Private
Public Access
2
0

syslog: remove all fprintf calls and use syslog instead

Syslog is now used for all error messages, return values in the code should be
used by programmers to see the status of the library/board and syslog can be
used to see quickly from a debugging perspective what has gone wrong. A few
cosmetics where improved as well as a mraa_set_log_level() call where the
syslog log mask can be set directly from libmraa.

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-09-25 14:31:04 +01:00
parent 68de395fea
commit 32d8a6f0ca
12 changed files with 184 additions and 131 deletions

View File

@@ -207,7 +207,8 @@ mraa_result_t mraa_init() __attribute__((constructor));
* De-Initilise MRAA
*
* This is not a strict requirement but useful to test memory leaks and for
* people who like super clean code.
* people who like super clean code. If dynamically loading & unloading
* libmraa you need to call this before unloading the library.
*/
void mraa_deinit();
@@ -234,6 +235,15 @@ unsigned int mraa_adc_raw_bits();
*/
unsigned int mraa_adc_supported_bits();
/**
* Sets the log level to use from 0-7 where 7 is very verbose. These are the
* syslog log levels, see syslog(3) for more information on the levels.
*
* @return Result of operation
*/
mraa_result_t mraa_set_log_level(int level);
#ifdef __cplusplus
}
#endif

View File

@@ -116,4 +116,15 @@ unsigned int adcSupportedBits()
return mraa_adc_supported_bits();
}
/**
* Sets the log level to use from 0-7 where 7 is very verbose. These are the
* syslog log levels, see syslog(3) for more information on the levels.
*
* @return Result of operation
*/
mraa_result_t setLogLevel(int level)
{
return mraa_set_log_level(level);
}
}