99using namespace odr ;
1010
1111int main (int argc, char **argv) {
12+ auto logger = Logger::create_stdio (" odr-server" , LogLevel::verbose);
13+
1214 std::string input{argv[1 ]};
1315
1416 std::optional<std::string> password;
@@ -20,17 +22,17 @@ int main(int argc, char **argv) {
2022 decode_preference.engine_priority = {
2123 DecoderEngine::poppler, DecoderEngine::wvware, DecoderEngine::odr};
2224
23- DecodedFile decoded_file{input, decode_preference};
25+ DecodedFile decoded_file{input, decode_preference, *logger };
2426
2527 if (decoded_file.password_encrypted () && !password) {
26- std::cerr << " document encrypted but no password given" << std::endl ;
28+ ODR_FATAL (*logger, " document encrypted but no password given" ) ;
2729 return 2 ;
2830 }
2931 if (decoded_file.password_encrypted ()) {
3032 try {
3133 decoded_file = decoded_file.decrypt (*password);
3234 } catch (const WrongPasswordError &) {
33- std::cerr << " wrong password" << std::endl ;
35+ ODR_FATAL (*logger, " wrong password" ) ;
3436 return 1 ;
3537 }
3638 }
@@ -47,10 +49,10 @@ int main(int argc, char **argv) {
4749 {
4850 std::string prefix = " one_file" ;
4951 HtmlViews views = server.serve_file (decoded_file, prefix, html_config);
50- std::cout << " hosted decoded file with id: " << prefix << std::endl ;
52+ ODR_INFO (*logger, " hosted decoded file with id: " << prefix) ;
5153 for (const auto &view : views) {
52- std::cout << " http://localhost:8080/file/ " << prefix << " / " << view. path ()
53- << std::endl ;
54+ ODR_INFO (*logger,
55+ " http://localhost:8080/file/ " << prefix << " / " << view. path ()) ;
5456 }
5557 }
5658
0 commit comments