Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ interface Logger {
+ void Flush() = 0;
+ void PushLog(LogMessage) = 0;
+ Logger& instance(Logger* initializer = nullptr) = 0;
+ void InitLoggerSettings(LoggerSettings) = 0;
+ void InitFlushLogsTimePoint(TimePoint) = 0;
}

class AutoTrace {
Expand Down
15 changes: 13 additions & 2 deletions docs/Developer Documentation/Logger/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ The `Logger` interface contains only methods required by any SDL component to pe
* PushLog(LogMessage)
* IsEnabledFor(LogLevel)
* DeInit()
* Flush()
* Flush()
* InitLoggerSettings(LoggerSettings)
* InitFlushLogsTimePoint(TimePoint)


## Logger Implementation
Expand All @@ -40,7 +42,16 @@ The `Logger` interface contains only methods required by any SDL component to pe
The message loop thread is needed to avoid significant performance degradation at run time as logging calls are blocking calls and might take a significant amount of time. `LoggerImpl::PushLog` is a non-blocking call. It will put the log message into the queue and returns immediately.


If `ThirdPartyLoggerInterface` supports non blocking threaded logging, minor changes in `LoggerImpl` can be made with `use_message_loop_thread = false`.
If `ThirdPartyLoggerInterface` supports non blocking threaded logging, minor changes in `LoggerImpl` can be made with `use_message_loop_thread = false`.

### Configurable time before shutdown

To prevent missing logs after SDL shutdown, after receiving IGNITION_OFF signal SDL dumps all logs into the file system before shutdown. To control logs flushing process SDL logger has additional ini file options:

* Write all logs to file system before shutdown(using `LoggerImpl::Flush` function)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"write all logs" is misleading info, it does not guarantee all logs are written to the disk with a small maximum wait time.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the string FlushLogMessagesBeforeShutdown in the sdl proposal is better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't quite get what you mean. Per the proposal FlushLogMessagesBeforeShutdown is Boolean, not string. Could you please clarify this?
I can suggest to change "Write all logs to file system before shutdown" to "Write logs from queue to file system before shutdown"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the following from the proposal
option to flush log messages before shutdown.
option that specifies maximum time before shutdown.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladSemenyuk the keyword "all" that causes the confusion, my understanding is everything in the logs will be written to disk, that is all. but it might not be the case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yang1070 Done

* Configure maximum time to wait for SDL to shut down

Logger recieves shutdown settings via `LoggerImpl::InitLoggerSettings(LoggerSettings)`

## Logger singleton

Expand Down