~ubuntu-branches/ubuntu/vivid/vanessa-logger/vivid-proposed

« back to all changes in this revision

Viewing changes to libvanessa_logger/vanessa_logger.h

  • Committer: Bazaar Package Importer
  • Author(s): Simon Horman
  • Date: 2010-06-08 13:42:33 UTC
  • mfrom: (0.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100608134233-ji3m7r82l5dq11m4
Tags: 0.0.9-1
New upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
 * vanessa_logger_strherror_r
278
278
 * Returns a string describing the error code present in errnum
279
279
 * according to the errors for h_errno which is set by gethostbyname(3)
280
 
 * gethostbyaddr(3) and others. Analagous to strerror_r(3).
 
280
 a
 
281
 * gethostbyaddr(3) and others. Analogous to strerror_r(3).
281
282
 * pre: errnum: Error to show as a string
282
283
 *      buf: buffer to write error string to
283
284
 *      n: length of buf in bytes
284
285
 * post: on success error string is written to buf
285
 
 *       on invalud input errno is set to -EINVAL
 
286
 *       on invalid input errno is set to -EINVAL
286
287
 *       if buf is too short then errno is set to -ERANGE
287
288
 * return: 0 on success
288
289
 *         -1 on error
313
314
 * vanessa_logger_set_flag
314
315
 * Set flags for logger
315
316
 * Should only be used on filehandle or filename loggers,
316
 
 * ignored otherewise.
 
317
 * ignored otherwise.
317
318
 * pre: vl: logger to set flags of
318
319
 *      flag: value to set flags to
319
320
 *            See "Flags for filehandle or filename loggers"
348
349
 * pre: vl: Vanessa logger to log errors to. May be NULL.
349
350
 *      buffer: buffer to sanitise
350
351
 *      size: number of bytes in buffer to sanitise
351
 
 *      flag: If VANESSA_LOGGER_STR_DUMP_HEX then a hexidecimal dump
 
352
 *      flag: If VANESSA_LOGGER_STR_DUMP_HEX then a hexadecimal dump
352
353
 *            will be done. Else an octal dump will be done.
353
354
 * post: a new buffer is alocated. For each byte in buffer
354
355
 *       that is a printable ASCII character it is added to
381
382
/**********************************************************************
382
383
 * vanessa_logger_vl_set
383
384
 * set the logger function to use with convenience macros
384
 
 * No logging will take place using conveineince macros if logger is 
 
385
 * No logging will take place using convenience macros if logger is 
385
386
 * set to NULL (default). That is you _must_ call this function to 
386
387
 * enable logging using convenience macros.
387
388
 * pre: logger: pointer to a vanessa_logger
388
 
 * post: logger for convenience marcros is set to logger
 
389
 * post: logger for convenience macros is set to logger
389
390
 * return: none
390
391
 **********************************************************************/
391
392
 
393
394
 
394
395
 
395
396
/**********************************************************************
396
 
 * vanessa_logger_vl_set_filehandle
397
 
 * set the logger function to a logger created for the filehandle 
398
 
 * No logging will take place using conveineince macros if logger is set to
399
 
 * NULL (default). That is you _must_ call one of the vanessa_logger_vl_set
400
 
 * functions to enable logging using convenience macros.
401
 
 * pre:  fd: filehandle to log to 
402
 
 * post: logger for filehandle is created and set as the 
403
 
 *       logger for convenience marcros 
404
 
 * created for the filehandle return: none
405
 
 **********************************************************************/
406
 
 
407
 
vanessa_logger_t *
408
 
vanessa_logger_set_filehandle(FILE *fh);
409
 
 
410
 
 
411
 
/**********************************************************************
412
397
 * vanessa_logger_vl_unset
413
398
 * set logger to use with convenience macros to NULL
414
399
 * That is no logging will take place when convenience macros are called
422
407
 
423
408
/**********************************************************************
424
409
 * vanessa_logger_vl_get
425
 
 * retreive the logger function used by convenience macros
 
410
 * retrieve the logger function used by convenience macros
426
411
 * pre: none
427
412
 * post: none
428
413
 * return: logger used by convenience macros
456
441
 
457
442
#define VANESSA_LOGGER_DEBUG_UNSAFE(fmt, ...) \
458
443
        _vanessa_logger_log_prefix(__vanessa_logger_vl, LOG_DEBUG, \
459
 
                __FUNCTION__, fmt, __VA_ARGS__)
 
444
                __func__, fmt, __VA_ARGS__)
460
445
 
461
446
#define VANESSA_LOGGER_DEBUG(str) \
462
447
        _vanessa_logger_log_prefix(__vanessa_logger_vl, LOG_DEBUG, \
463
 
                __FUNCTION__, "%s", str)
 
448
                __func__, "%s", str)
464
449
 
465
450
#define VANESSA_LOGGER_DEBUG_ERRNO(str) \
466
451
        _vanessa_logger_log_prefix(__vanessa_logger_vl, LOG_DEBUG, \
467
 
                __FUNCTION__, "%s: %s", str, strerror(errno))
 
452
                __func__, "%s: %s", str, strerror(errno))
468
453
 
469
454
#define VANESSA_LOGGER_DEBUG_HERRNO(str) \
470
455
        _vanessa_logger_log_prefix(__vanessa_logger_vl, LOG_DEBUG, \
471
 
                __FUNCTION__, "%s: %s", str, \
 
456
                __func__, "%s: %s", str, \
472
457
                vanessa_logger_strherror(h_errno))
473
458
 
474
459
#define VANESSA_LOGGER_DEBUG_RAW_UNSAFE(fmt, ...) \