Skip to content

Commit 025fccf

Browse files
authored
Merge pull request #6170 from ev-mp/el
W/A for EasyLogging on Linux
2 parents 44e4cfb + d251490 commit 025fccf

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

common/notifications.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@ namespace rs2
702702
{
703703
std::lock_guard<std::recursive_mutex> lock(m);
704704
if (!line.size()) return;
705+
// Limit the notification window
706+
while (log.size() > 200)
707+
log.pop_front();
705708
if (line[line.size() - 1] != '\n') line += "\n";
706709
log.push_back(line);
707710
new_log = true;

common/notifications.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ namespace rs2
195195
std::recursive_mutex m;
196196
bool new_log = false;
197197

198-
std::vector<std::string> log;
198+
std::deque<std::string> log;
199199
std::shared_ptr<notification_model> selected;
200200
std::chrono::system_clock::time_point last_snoozed;
201201
};

common/viewer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,9 @@ namespace rs2
785785
viewer_model::viewer_model(context &ctx_)
786786
: ppf(*this),
787787
ctx(ctx_),
788+
frameset_alloc(this),
788789
synchronization_enable(true),
789-
zo_sensors(0),
790-
frameset_alloc(this)
790+
zo_sensors(0)
791791
{
792792
syncer = std::make_shared<syncer_model>();
793793
reset_camera();
@@ -1677,7 +1677,7 @@ namespace rs2
16771677
ImGui::PushStyleColor( ImGuiCol_Text, ImColor( 1.f, 1.f, 1.f, a ) );
16781678
ImColor bg( dark_sensor_bg.x, dark_sensor_bg.y, dark_sensor_bg.z, dark_sensor_bg.w * a );
16791679

1680-
if( object.mean_depth )
1680+
if( fabs(object.mean_depth) > 0.f )
16811681
{
16821682
std::string str = to_string() << std::setprecision( 2 ) << object.mean_depth << " m";
16831683
auto size = ImGui::CalcTextSize( str.c_str() );
@@ -1688,7 +1688,7 @@ namespace rs2
16881688
{ bbox.x + size.x + 20, bbox.y + size.y + 6 },
16891689
bg );
16901690
ImGui::SetCursorScreenPos( { bbox.x + 10, bbox.y + 3 } );
1691-
ImGui::Text( str.c_str() );
1691+
ImGui::Text("%s", str.c_str() );
16921692
h -= size.y;
16931693
}
16941694
}
@@ -1702,7 +1702,7 @@ namespace rs2
17021702
{ bbox.x + bbox.w - 1, bbox.y + bbox.h - 1 },
17031703
bg );
17041704
ImGui::SetCursorScreenPos( { bbox.x + bbox.w - size.x - 10, bbox.y + bbox.h - size.y - 4 } );
1705-
ImGui::Text( object.name.c_str() );
1705+
ImGui::Text("%s", object.name.c_str() );
17061706
h -= size.y;
17071707
}
17081708
}

tools/realsense-viewer/realsense-viewer.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,14 @@ int main(int argc, const char** argv) try
323323
protected:
324324
void handle( const el::LogDispatchData* data ) noexcept override
325325
{
326-
vm->not_model.add_log(
327-
data->logMessage()->logger()->logBuilder()->build(
328-
data->logMessage(),
329-
data->dispatchAction() == el::base::DispatchAction::NormalLog
330-
));
326+
// TODO align LRS and Easyloging severity levels. W/A for easylogging on Linux
327+
if (data->logMessage()->level() > el::Level::Debug)
328+
{
329+
vm->not_model.add_log(
330+
data->logMessage()->logger()->logBuilder()->build(
331+
data->logMessage(),
332+
data->dispatchAction() == el::base::DispatchAction::NormalLog));
333+
}
331334
}
332335
};
333336
el::Helpers::installLogDispatchCallback< viewer_model_dispatcher >( "viewer_model_dispatcher" );

0 commit comments

Comments
 (0)