Skip to content

Commit

Permalink
Merge pull request #1615 from Framstag/switch-to-using-logger
Browse files Browse the repository at this point in the history
refactor: use logger instead std::cxxx
  • Loading branch information
Framstag authored Oct 6, 2024
2 parents a15448b + def233d commit 855a7a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
18 changes: 8 additions & 10 deletions libosmscout-map-cairo/src/osmscoutmapcairo/MapPainterCairo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#include <osmscoutmapcairo/MapPainterCairo.h>

#include <iostream>
#include <iomanip>
#include <limits>
#include <list>

Expand Down Expand Up @@ -499,13 +497,13 @@ namespace osmscout {

images[idx] = image;

std::cout << "Loaded image '" << filename << "'" << std::endl;
log.Debug() << "Loaded image '" << filename << "'";

return true;
}
}

std::cerr << "ERROR while loading image '" << style.GetIconName() << "'" << std::endl;
log.Error() << "ERROR while loading image '" << style.GetIconName() << "'";
style.SetIconId(0);

return false;
Expand Down Expand Up @@ -553,13 +551,13 @@ namespace osmscout {
cairo_matrix_init_scale(&matrix, 1, 1);
cairo_pattern_set_matrix(patterns[idx], &matrix);

std::cout << "Loaded pattern image '" << filename << "'" << std::endl;
log.Debug() << "Loaded pattern image '" << filename << "'";

return true;
}
}

std::cerr << "ERROR while loading pattern image '" << style.GetPatternName() << "'" << std::endl;
log.Error() << "ERROR while loading pattern image '" << style.GetPatternName() << "'";
style.SetPatternId(0);

return false;
Expand Down Expand Up @@ -680,7 +678,7 @@ namespace osmscout {
std::vector<Glyph<MapPainterCairo::CairoNativeGlyph>> result;

if constexpr (debugLabelLayouter) {
std::cout << " = getting glyphs for label: " << text << std::endl;
log.Debug() << " = getting glyphs for label: " << text;
}

for (PangoLayoutIter *iter = pango_layout_get_iter(label.get());
Expand All @@ -696,7 +694,7 @@ namespace osmscout {
g_object_ref(font.get());

if constexpr (debugLabelLayouter) {
std::cout << " run with " << run->glyphs->num_glyphs << " glyphs (font " << font.get() << "):" << std::endl;
log.Debug() << " run with " << run->glyphs->num_glyphs << " glyphs (font " << font.get() << ")";
}

for (int gi=0; gi < run->glyphs->num_glyphs; gi++){
Expand All @@ -718,8 +716,8 @@ namespace osmscout {
(double)glyphInfo.geometry.y_offset/(double)PANGO_SCALE);

if constexpr (debugLabelLayouter) {
std::cout << " " << glyphInfo.glyph << ": " << result.back().position.GetX() << " x "
<< result.back().position.GetY() << std::endl;
log.Debug() << " " << glyphInfo.glyph << ": " << result.back().position.GetX() << " x "
<< result.back().position.GetY();
}

glyphInfo.geometry.x_offset = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#include <osmscoutmapdirectx/MapPainterDirectX.h>

#include <iostream>
#include <iomanip>
#include <limits>
#include <list>

Expand Down Expand Up @@ -415,7 +413,7 @@ namespace osmscout
return m_Fonts.insert(std::make_pair(hash, pTextFormat)).first->second;
}

std::cerr << "Could not get font " << parameter.GetFontName() << " " << fontSize << std::endl;
log.Error() << "Could not get font " << parameter.GetFontName() << " " << fontSize;
return nullptr;
}

Expand Down Expand Up @@ -506,7 +504,7 @@ namespace osmscout
}
}

std::cerr << "ERROR while loading image '" << style.GetIconName() << "'" << std::endl;
log.Error() << "ERROR while loading image '" << style.GetIconName() << "'";
style.SetIconId(0);

return false;
Expand Down

0 comments on commit 855a7a8

Please sign in to comment.