libfuse

Typedefs | Enumerations | Functions
fuse_log.h File Reference
`#include <stdarg.h>`

Go to the source code of this file.

## Typedefs
typedef void(* | fuse_log_func_t) (enum fuse_log_level level, const char *fmt, va_list ap)

## Enumerations
enum | fuse_log_level

## Functions
void | fuse_set_log_func (fuse_log_func_t func)
void | fuse_log (enum fuse_log_level level, const char *fmt,...)
void | fuse_log_enable_syslog (const char *ident, int option, int facility)
void | fuse_log_close_syslog (void)

## Detailed Description

This file defines the logging interface of FUSE

Definition in file fuse_log.h.

## Typedef Documentation

## ◆ fuse_log_func_t

typedef void(* fuse_log_func_t) (enum fuse_log_level level, const char *fmt, va_list ap)

Log message handler function.

This function must be thread-safe. It may be called from any libfuse function, including fuse_parse_cmdline() and other functions invoked before a FUSE filesystem is created.

Install a custom log message handler function using fuse_set_log_func().

Parameters

  level | log severity level
  fmt | sprintf-style format string including newline
  ap | format string arguments

Definition at line 52 of file fuse_log.h.

## Enumeration Type Documentation

## ◆ fuse_log_level

enum fuse_log_level

Log severity level

These levels correspond to syslog(2) log levels since they are widely used.

Definition at line 28 of file fuse_log.h.

## Function Documentation

## ◆ fuse_log()

void fuse_log | ( | enum fuse_log_level | level,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Emit a log message

Parameters

  level | severity level (FUSE_LOG_ERR, FUSE_LOG_DEBUG, etc)
  fmt | sprintf-style format string including newline

Definition at line 77 of file fuse_log.c.

## ◆ fuse_log_close_syslog()

void fuse_log_close_syslog | ( | void |  | ) |

To be called at teardown to close syslog.

Definition at line 93 of file fuse_log.c.

## ◆ fuse_log_enable_syslog()

void fuse_log_enable_syslog | ( | const char * | ident,
|  | int | option,
|  | int | facility
| ) |  |

Switch default log handler from stderr to syslog

Passed options are according to 'man 3 openlog'

Definition at line 86 of file fuse_log.c.

## ◆ fuse_set_log_func()

void fuse_set_log_func | ( | fuse_log_func_t | func | ) |

Install a custom log handler function.

Log messages are emitted by libfuse functions to report errors and debug information. Messages are printed to stderr by default but this can be overridden by installing a custom log message handler function.

The log message handler function is global and affects all FUSE filesystems created within this process.

Parameters

  func | a custom log message handler function or NULL to revert to the default

Definition at line 69 of file fuse_log.c.