Changeset 0cd7064a1b656cd87e61af14b74ec6c80c341fe6
- Timestamp:
- 03/12/08 23:13:11
(4 months ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1205359991 +0100
- git-parent:
[021c332008d24ef503eddc6ad41f3392a5816e60]
- git-author:
- Rafaël Carré <funman@videolan.org> 1205359991 +0100
- Message:
Improvements to syslog logger - by Hans Lambermont
- add PID to syslog and use lowercase vlc (conforming to syslog standards)
- add the command-line verbosity control -v[0-2] to html/text/syslog
logging, such that one can disable f.i. LOG_DEBUG from being offered
to html/text/syslog completely.
- add the priority to the syslog message
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf70e66e |
r0cd7064 |
|
| 98 | 98 | Haakon Meland Eriksen - Norwegian translation |
|---|
| 99 | 99 | Han HoJoong <0demon0 at paran dot com> - Korean translation |
|---|
| | 100 | Hans Lambermont <hans dot lambermont at newtec dot eu> - Syslog improvements |
|---|
| 100 | 101 | Hans-Peter Jansen <hpj at urpla.net> - patch for module options handling |
|---|
| 101 | 102 | Hannes Domani <ssbssa at yahoo dot de> - Qt4 interfaces patches |
|---|
| r99fab90 |
r0cd7064 |
|
| 98 | 98 | static void Run ( intf_thread_t * ); |
|---|
| 99 | 99 | |
|---|
| 100 | | static void FlushQueue ( msg_subscription_t *, FILE *, int ); |
|---|
| | 100 | static void FlushQueue ( msg_subscription_t *, FILE *, int, int ); |
|---|
| 101 | 101 | static void TextPrint ( const msg_item_t *, FILE * ); |
|---|
| 102 | 102 | static void HtmlPrint ( const msg_item_t *, FILE * ); |
|---|
| … | … | |
| 278 | 278 | p_intf->p_sys->p_file = NULL; |
|---|
| 279 | 279 | #ifdef HAVE_SYSLOG_H |
|---|
| 280 | | openlog( "VLC", 0, LOG_DAEMON ); |
|---|
| | 280 | openlog( "VLC", LOG_PID|LOG_NDELAY, LOG_DAEMON ); |
|---|
| 281 | 281 | #endif |
|---|
| 282 | 282 | } |
|---|
| … | … | |
| 306 | 306 | /* Flush the queue and unsubscribe from the message queue */ |
|---|
| 307 | 307 | FlushQueue( p_intf->p_sys->p_sub, p_intf->p_sys->p_file, |
|---|
| 308 | | p_intf->p_sys->i_mode ); |
|---|
| | 308 | p_intf->p_sys->i_mode, p_intf->p_libvlc->i_verbose ); |
|---|
| 309 | 309 | msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub ); |
|---|
| 310 | 310 | |
|---|
| … | … | |
| 344 | 344 | { |
|---|
| 345 | 345 | FlushQueue( p_intf->p_sys->p_sub, p_intf->p_sys->p_file, |
|---|
| 346 | | p_intf->p_sys->i_mode ); |
|---|
| | 346 | p_intf->p_sys->i_mode, p_intf->p_libvlc->i_verbose ); |
|---|
| 347 | 347 | |
|---|
| 348 | 348 | if( p_intf->p_sys->p_rrd ) |
|---|
| … | … | |
| 356 | 356 | * FlushQueue: flush the message queue into the log |
|---|
| 357 | 357 | *****************************************************************************/ |
|---|
| 358 | | static void FlushQueue( msg_subscription_t *p_sub, FILE *p_file, int i_mode ) |
|---|
| | 358 | static void FlushQueue( msg_subscription_t *p_sub, FILE *p_file, int i_mode, |
|---|
| | 359 | int i_verbose ) |
|---|
| 359 | 360 | { |
|---|
| 360 | 361 | int i_start, i_stop; |
|---|
| … | … | |
| 371 | 372 | i_start = (i_start+1) % VLC_MSG_QSIZE ) |
|---|
| 372 | 373 | { |
|---|
| | 374 | switch( p_sub->p_msg[i_start].i_type ) |
|---|
| | 375 | { |
|---|
| | 376 | case VLC_MSG_ERR: |
|---|
| | 377 | if( i_verbose < 0 ) continue; |
|---|
| | 378 | break; |
|---|
| | 379 | case VLC_MSG_INFO: |
|---|
| | 380 | if( i_verbose < 0 ) continue; |
|---|
| | 381 | break; |
|---|
| | 382 | case VLC_MSG_WARN: |
|---|
| | 383 | if( i_verbose < 1 ) continue; |
|---|
| | 384 | break; |
|---|
| | 385 | case VLC_MSG_DBG: |
|---|
| | 386 | if( i_verbose < 2 ) continue; |
|---|
| | 387 | break; |
|---|
| | 388 | } |
|---|
| | 389 | |
|---|
| 373 | 390 | switch( i_mode ) |
|---|
| 374 | 391 | { |
|---|
| … | … | |
| 408 | 425 | static void SyslogPrint( const msg_item_t *p_msg ) |
|---|
| 409 | 426 | { |
|---|
| 410 | | int i_priority = LOG_INFO; |
|---|
| 411 | | |
|---|
| 412 | | if( p_msg->i_type == 0 ) i_priority = LOG_INFO; |
|---|
| 413 | | if( p_msg->i_type == 1 ) i_priority = LOG_ERR; |
|---|
| 414 | | if( p_msg->i_type == 2 ) i_priority = LOG_WARNING; |
|---|
| 415 | | if( p_msg->i_type == 3 ) i_priority = LOG_DEBUG; |
|---|
| | 427 | static const int i_prio[4] = { LOG_INFO, LOG_ERR, LOG_WARNING, LOG_DEBUG }; |
|---|
| | 428 | int i_priority = i_prio[p_msg->i_type]; |
|---|
| 416 | 429 | |
|---|
| 417 | 430 | if( p_msg->psz_header ) |
|---|
| 418 | | syslog( i_priority, "%s %s: %s", p_msg->psz_header, |
|---|
| | 431 | syslog( i_priority, "%s%s %s: %s", p_msg->psz_header, |
|---|
| | 432 | ppsz_type[p_msg->i_type], |
|---|
| 419 | 433 | p_msg->psz_module, p_msg->psz_msg ); |
|---|
| 420 | 434 | else |
|---|
| 421 | | syslog( i_priority, "%s: %s", p_msg->psz_module, p_msg->psz_msg ); |
|---|
| | 435 | syslog( i_priority, "%s%s: %s", p_msg->psz_module, |
|---|
| | 436 | ppsz_type[p_msg->i_type], p_msg->psz_msg ); |
|---|
| 422 | 437 | |
|---|
| 423 | 438 | } |
|---|