Bienvenue sur le site de la LibLapin.
Jetez un coup d'oeil en bas de la page pour choisir votre niveau de documentation en fonction de votre niveau avec la LibLapin.
Pour l'instant, c'est réglé sur 'Manuel complet'. Si c'est votre première fois avec la LibLapin, il vaudrait mieux choisir 'Débutant'.
De même, n'oubliez pas de préciser une version de la bibliothèque.

LibLapin's logo

LibLapin

Error





The error module header is lapin/error.h

Description

     This macro writes into your program the code sent as parameter if B‌U‌N‌N‌Y‌_‌D‌E‌B‌U‌G was defined when you start compiling.
If it was not defined, nothing is generated.



INDEX


Description

     This macro writes into your program the code sent as parameter if B‌U‌N‌N‌Y‌_‌L‌O‌G was defined when you start compiling.
If it was not defined, nothing is generated.



INDEX

typedef enum e_bunny_color
{
     BE_CANT_GENERATE_RESSOURCE,
     BE_SYNTAX_ERROR,
     BE_BAD_ADDRESS,
     BE_TYPE_ERROR,
     BE_CONTAINER_IS_EMPTY,
     BE_CANNOT_DUPLICATE,
     BE_CANNOT_FIND_ELEMENT,
     BE_CANNOT_FIND_EMBEDDED_KEY,
     BE_UNKNOWN_DISPLAY_DEVICE,

} t‌_‌b‌u‌n‌n‌y‌_‌c‌o‌l‌o‌r;

Description

     This enumeration describe additionnal error code that can be set inside errno. They are used by the bunny library and can be use by your program if you want to identify an error.

They are valid error codes to be sent to b‌u‌n‌n‌y‌_‌s‌t‌r‌e‌r‌r‌o‌r, as any other errno code. Do not use the system strerror!



INDEX


Description

     The macro b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o is a simple wrapper around the system errno. Any errno valid value are valid for b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o, any t_b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o value are valid for b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o. b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o can be send to b‌u‌n‌n‌y‌_‌s‌t‌r‌e‌r‌r‌o‌r to display a human readable error explaination.



INDEX


Description

     Return a human readable string that explain the sent error code.

Parameters


Return value

A human readable string explaining the error code, or NULL if the error code is invalid.




INDEX


Description

     Print the sent string followed by ':', a space and the b‌u‌n‌n‌y‌_‌s‌t‌r‌e‌r‌r‌o‌r string returned after sending it the current b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o value.
If the sent value was NULL, only the b‌u‌n‌n‌y‌_‌s‌t‌r‌e‌r‌r‌o‌r message is displayed.
A final newline is printed at the end.

Parameters

  • const char *str:
         The context of failure. A classic value is the name of the function that failed.



INDEX


Description

     This function sets the file descirptor used for error logging. You can send a negative file descriptor to disable error logging. By default, the file descriptor used is STDERR_FILENO.

Parameters

  • int fd:
         The file descriptor to use for error logging. By default, it is STDERR_FILENO. Sending -1 disable error logging.



INDEX


Description

     This function returns the currently used file descriptor for error logging. By default, it is STDERR_FILENO.

Return value

The file descriptor currently being used for error logging. By default, it is STDERR_FILENO.




INDEX


Description

     This function sets the file descirptor used for standard logging. You can send a negative file descriptor to disable standard logging. By default, the file descriptor used is STDOUT_FILENO.

Parameters

  • int fd:
         The file descriptor to use for standard logging. By default, it is STDOUT_FILENO. Sending -1 disable standard logging.



INDEX


Description

     This function returns the currently used file descriptor for standard logging. By default, it is STDOUT_FILENO.

Return value

The file descriptor currently being used for standard logging. By default, it is STDOUT_FILENO.




INDEX


Description

     This function allows you to define filter to only get logs that interest you. Error logs and standard logs are both concerned.

Parameters

  • const char *labels:
         A list of labels separated with a single comma and no whitespace.
    LibLapin labels are:
    • system
    • ressource
    • graphics
    • sound
    • configuration
    • security
    • unix
    • syntax
    • network
    • hardware


INDEX


Description

     Set if you prefer having complete logs or only human readable message.
The complete format is:
FAILURE/LOG [tags][timestamp][file:line][Error type][Detailed message]

If the log is an error, the incomplete format is:
Error type - Detailed message

If it is a standard log, the incomplete format is:
Detailed message

Parameters

  • bool complete:
         true or false if you want complete or incomplete log.


INDEX