Added a macro to log with a condition

This commit is contained in:
emeric
2025-07-17 20:52:06 +02:00
parent 4d4f83130a
commit 08ac5f0b10
4 changed files with 13 additions and 12 deletions
@@ -167,8 +167,7 @@ namespace lms::db
void PlayListFile::setName(std::string_view name)
{
_name = std::string{ name, 0, _maxNameLength };
if (name.size() > _maxNameLength)
LMS_LOG(DB, WARNING, "PlaylistFile name too long, truncated to '" << _name << "'");
LMS_LOG_IF(DB, WARNING, name.size() > _maxNameLength, "PlaylistFile name too long, truncated to '" << _name << "'");
}
void PlayListFile::setFiles(std::span<const std::filesystem::path> files)