Skip to content

Commit e3e2697

Browse files
committed
handle empty string and clarify level formatting
1 parent f4b0f11 commit e3e2697

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/viam/sdk/config/resource.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,15 @@ void to_proto_impl<ResourceConfig>::operator()(const ResourceConfig& self,
155155

156156
ResourceConfig from_proto_impl<app::v1::ComponentConfig>::operator()(
157157
const app::v1::ComponentConfig* proto) const {
158+
const std::string& level_str = proto->log_configuration().level();
158159
return ResourceConfig(proto->type(),
159160
proto->name(),
160161
proto->namespace_(),
161162
from_proto(proto->attributes()),
162163
proto->api(),
163164
Model::from_str(proto->model()),
164165
proto->has_frame() ? from_proto(proto->frame()) : LinkConfig{},
165-
level_from_string(proto->log_configuration().level()));
166+
level_str.empty() ? log_level::info : level_from_string(level_str));
166167
}
167168

168169
std::vector<ResourceConfig>

src/viam/sdk/log/logger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ log_level level_from_string(std::string level) {
5454
return ll::fatal;
5555
}
5656

57-
VIAM_LOG(warn) << "Returning unknown log level " << level << " as info";
57+
VIAM_LOG(warn) << "Returning unknown log level `" << level << "` as info";
5858
return ll::info;
5959
}
6060

0 commit comments

Comments
 (0)