@@ -177,7 +177,7 @@ void dbg_(const char *fcn, long line, const char *fmt, ...)
177177 va_end (ap );
178178}
179179
180- void error_handler (const char * file , int line , const char * function , int err , const char * fmt , ...)
180+ void error_handler (const char * file , int line , const char * function , int errcode , const char * fmt , ...)
181181{
182182 char buf [2048 ];
183183 va_list arg ;
@@ -187,12 +187,36 @@ void error_handler(const char *file, int line, const char *function, int err, co
187187 va_end (arg );
188188 if (use_syslog )
189189 syslog (LOG_ERR , "alsa-lib %s:%i:(%s) %s%s%s\n" , file , line , function ,
190- buf , err ? ": " : "" , err ? snd_strerror (err ) : "" );
190+ buf , errcode ? ": " : "" , errcode ? snd_strerror (errcode ) : "" );
191191 else
192192 fprintf (stderr , "alsa-lib %s:%i:(%s) %s%s%s\n" , file , line , function ,
193- buf , err ? ": " : "" , err ? snd_strerror (err ) : "" );
193+ buf , errcode ? ": " : "" , errcode ? snd_strerror (errcode ) : "" );
194194}
195195
196+ #if SND_LIB_VER (1 , 2 , 15 ) >= SND_LIB_VERSION
197+ void log_handler (int prio , int interface , const char * file , int line , const char * function , int errcode , const char * fmt , va_list arg )
198+ {
199+ char buf [2048 ], level [50 ] = "" ;
200+ const char * text1 , * text2 ;
201+
202+ if (!snd_lib_log_filter (prio , interface , NULL ))
203+ return ;
204+
205+ text1 = snd_lib_log_priority (prio );
206+ text2 = snd_lib_log_interface (interface );
207+ if (text1 || text2 )
208+ snprintf (level , sizeof (level ), "[%s.%s] " , text1 ? text1 : "" , text2 ? text2 : "" );
209+
210+ vsnprintf (buf , sizeof (buf ), fmt , arg );
211+ if (use_syslog )
212+ syslog (LOG_ERR , "alsa-lib %s:%i:(%s) %s%s%s%s\n" , file , line , function , level ,
213+ buf , errcode ? ": " : "" , errcode ? snd_strerror (errcode ) : "" );
214+ else
215+ fprintf (stderr , "alsa-lib %s:%i:(%s) %s%s%s%s\n" , file , line , function , level ,
216+ buf , errcode ? ": " : "" , errcode ? snd_strerror (errcode ) : "" );
217+ }
218+ #endif
219+
196220int load_configuration (const char * file , snd_config_t * * top , int * open_failed )
197221{
198222 snd_config_t * config ;
0 commit comments