---
name: "loc_set_log_fn"
section: "3"
platform: "linux"
package: "libloc"
version: "0.9.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/loc_set_log_fn"
---

# loc\_set\_log\_fn(3)

Sets the log callback function

## NAME

loc\_set\_log\_fn - Sets the log callback function

## SYNOPSIS

```
#include <libloc/libloc.h>
```

void loc\_set\_log\_fn(struct loc\_ctx\* ctx, void (\*log\_fn)(struct loc\_ctx\* ctx, int priority, const char\* file, int line, const char\* fn, const char\* format, va\_list args)

## DESCRIPTION

libloc can use the calling application’s logging system by setting this callback.

It will be called once for each log message according to the configured log level.

## SEE ALSO

[**libloc**(3)](/libloc/3.md)

## AUTHORS

Michael Tremer
