3131#include <string.h>
3232
3333#include "alloc-private.h"
34+ #include "logging-private.h"
3435
3536static void * s_impl_library = 0 ;
3637static struct wpe_loader_interface * s_impl_loader = 0 ;
@@ -68,7 +69,7 @@ load_impl_library()
6869#ifdef WPE_BACKEND
6970 s_impl_library = dlopen (WPE_BACKEND , RTLD_NOW );
7071 if (!s_impl_library ) {
71- fprintf ( stderr , "wpe: could not load compile-time defined WPE_BACKEND: %s\n " , dlerror ());
72+ wpe_log_fatal ( " could not load compile-time defined WPE_BACKEND: %s" , dlerror ());
7273 abort ();
7374 }
7475#else
@@ -78,7 +79,7 @@ load_impl_library()
7879 if (env_library_name ) {
7980 s_impl_library = dlopen (env_library_name , RTLD_NOW );
8081 if (!s_impl_library ) {
81- fprintf ( stderr , "wpe: could not load specified WPE_BACKEND_LIBRARY: %s\n " , dlerror ());
82+ wpe_log_fatal ( " could not load specified WPE_BACKEND_LIBRARY: %s" , dlerror ());
8283 abort ();
8384 }
8485 wpe_loader_set_impl_library_name (env_library_name );
@@ -88,7 +89,7 @@ load_impl_library()
8889 // Load libWPEBackend-default.so by ... default.
8990 s_impl_library = dlopen ("libWPEBackend-default.so" , RTLD_NOW );
9091 if (!s_impl_library ) {
91- fprintf ( stderr , "wpe: could not load the impl library. Is there any backend installed?: %s\n " , dlerror ());
92+ wpe_log_fatal ( " could not load the impl library. Is there any backend installed?: %s" , dlerror ());
9293 abort ();
9394 }
9495 wpe_loader_set_impl_library_name ("libWPEBackend-default.so" );
@@ -103,21 +104,21 @@ wpe_loader_init(const char* impl_library_name)
103104{
104105#ifndef WPE_BACKEND
105106 if (!impl_library_name ) {
106- fprintf ( stderr , "wpe_loader_init: invalid implementation library name\n " );
107+ wpe_log_fatal ( "wpe_loader_init: invalid implementation library name" );
107108 abort ();
108109 }
109110
110111 if (s_impl_library ) {
111112 if (!s_impl_library_name || strcmp (s_impl_library_name , impl_library_name ) != 0 ) {
112- fprintf ( stderr , "wpe_loader_init: already initialized\n " );
113+ wpe_log_fatal ( "wpe_loader_init: already initialized" );
113114 return false;
114115 }
115116 return true;
116117 }
117118
118119 s_impl_library = dlopen (impl_library_name , RTLD_NOW );
119120 if (!s_impl_library ) {
120- fprintf ( stderr , "wpe_loader_init could not load the library '%s': %s\n " , impl_library_name , dlerror ());
121+ wpe_log_error ( "wpe_loader_init could not load the library '%s': %s" , impl_library_name , dlerror ());
121122 return false;
122123 }
123124 wpe_loader_set_impl_library_name (impl_library_name );
@@ -147,15 +148,17 @@ wpe_load_object(const char* object_name)
147148
148149 if (s_impl_loader ) {
149150 if (!s_impl_loader -> load_object ) {
150- fprintf (stderr , "wpe_load_object: failed to load object with name '%s': backend doesn't implement load_object vfunc\n" , object_name );
151+ wpe_log_fatal (
152+ "wpe_load_object: failed to load object with name '%s': backend doesn't implement load_object vfunc" ,
153+ object_name );
151154 abort ();
152155 }
153156 return s_impl_loader -> load_object (object_name );
154157 }
155158
156159 void * object = dlsym (s_impl_library , object_name );
157160 if (!object )
158- fprintf ( stderr , "wpe_load_object: failed to load object with name '%s'\n " , object_name );
161+ wpe_log_error ( "wpe_load_object: failed to load object with name '%s'" , object_name );
159162
160163 return object ;
161164}
0 commit comments