Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9c5163

Browse files
Document decision for how we will approach logging from an interrupt context.
1 parent ec97e7d commit f9c5163

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# 2. Interrupt Logging Strategy
2+
3+
Date: 2021年04月15日
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
We received this request:
12+
13+
> We would like to be able to add an entry into the log during interrupt routines. The current circular buffer works fine for that, however default library behavior to initiates a flush when the buffer is full. This is a problem if we are in an interrupt routine. Perhaps we could put the logger into a state that does not flush. If it should have flushed, we can trigger an overrun condition that would be later logged by the main loop (where we would also control the flush timing).
14+
15+
## Decision
16+
17+
- We will create APIs that can be used to enable/disable the automated `flush` behavior.
18+
- We will create a `log_interrupt()` API that will disable flushing if it is enabled, and re-enabling the flush afterward.
19+
+ This API *will not* force a `flush()` to occur when re-enabling the auto-flush behavior.
20+
- We need to create a method that allows a user to identify when a circular buffer overrun has occurred prior to flushing.
21+
22+
## Consequences
23+
24+
- Users must be responsible for flushing the log buffer outside of the interrupt context
25+
- Because the `log_interrupt()` API does not trigger flush behavior when re-enabling the auto-flush mode, the user risks losing data if there is a non-interrupt log call that is made prior to flushing the buffer.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /