-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import logging | ||
|
||
logging.setLevel(logging.TRACE) | ||
|
||
logging.trace('trace') | ||
logging.debug('debug %d %s',123,'message') | ||
logging.info('info %d %s',123,'message') | ||
logging.warn('warn %d %s',123,'message') | ||
logging.error('error %d %s',123,'message') | ||
|
||
logging.log(logging.TRACE, "level: %d", logging.TRACE) | ||
logging.log(logging.DEBUG, "level: %d", logging.DEBUG) | ||
logging.log(logging.INFO, "level: %d", logging.INFO) | ||
logging.log(logging.WARN, "level: %d", logging.WARN) | ||
logging.log(logging.ERROR, "level: %d", logging.ERROR) |
Submodule micropython
updated
6 files
+5 −0 | genhdr/moduledefs.h | |
+1 −1 | genhdr/mpversion.h | |
+17 −2 | genhdr/qstrdefs.generated.h | |
+95 −0 | mp_flipper_logging.c | |
+14 −0 | mp_flipper_logging.h | |
+1 −1 | mpconfigport.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <furi.h> | ||
|
||
#include <mp_flipper_logging.h> | ||
#include <mp_flipper_runtime.h> | ||
|
||
#include "mp_flipper_context.h" | ||
|
||
static inline FuriLogLevel decode_log_level(uint8_t level) { | ||
switch(level) { | ||
case MP_FLIPPER_LOG_LEVEL_TRACE: | ||
return FuriLogLevelTrace; | ||
break; | ||
case MP_FLIPPER_LOG_LEVEL_DEBUG: | ||
return FuriLogLevelDebug; | ||
break; | ||
case MP_FLIPPER_LOG_LEVEL_INFO: | ||
return FuriLogLevelInfo; | ||
break; | ||
case MP_FLIPPER_LOG_LEVEL_WARN: | ||
return FuriLogLevelWarn; | ||
break; | ||
case MP_FLIPPER_LOG_LEVEL_ERROR: | ||
return FuriLogLevelError; | ||
break; | ||
default: | ||
return FuriLogLevelDefault; | ||
break; | ||
} | ||
} | ||
|
||
uint8_t mp_flipper_log_get_level() { | ||
mp_flipper_context_t* ctx = mp_flipper_context; | ||
|
||
return ctx->log_level; | ||
} | ||
|
||
void mp_flipper_log_set_level(uint8_t level) { | ||
mp_flipper_context_t* ctx = mp_flipper_context; | ||
|
||
ctx->log_level = level; | ||
} | ||
|
||
void mp_flipper_log(uint8_t raw_level, const char* message) { | ||
FuriLogLevel level = decode_log_level(raw_level); | ||
|
||
furi_log_print_format(level, "uPython", message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters