# zx_debuglog_write

## Summary

Write a message to the kernel debuglog.

## Declaration

    #include <zircon/syscalls.h>

    zx_status_t zx_debuglog_write(zx_handle_t handle,
                                  uint32_t options,
                                  const void* buffer,
                                  size_t buffer_size);

## Description

`zx_debuglog_write()` attempts to write *buffer* of size *buffer_size* bytes
to the kernel debuglog. The log entry is written at severity `ZX_LOG_INFO`.

*buffer* does not strictly require any particular format, but most userspace
tooling assumes the contents will be a valid UTF-8 string without any
NUL-termination. *buffer* will be truncated to some size less than
ZX_LOG_RECORD_MAX so that it may fit in the `data` field of `zx_log_record_t`.

*options* must be set to `0`.

## Rights

*handle* must be of type `ZX_OBJ_TYPE_LOG` and have `ZX_RIGHT_WRITE`.

## Return value

`zx_debuglog_write()` returns `ZX_OK` on success. In the event of failure,
a negative error value is returned.

## Errors

`ZX_ERR_ACCESS_DENIED` *handle* does not have `ZX_RIGHT_WRITE`.

`ZX_ERR_BAD_HANDLE` *handle* is not a valid handle.

`ZX_ERR_INVALID_ARGS` An invalid value to *options* was given, or *buffer*
was an invalid pointer.

`ZX_ERR_WRONG_TYPE` *handle* is not a debuglog handle.

## See also

- [`fuchsia.boot.WriteOnlyLog`](https://fuchsia.dev/reference/fidl/fuchsia.boot#WriteOnlyLog)

- [`zx_debug_write()`](https://fuchsia.dev/reference/syscalls/debug_write)

- [`zx_debuglog_create()`](https://fuchsia.dev/reference/syscalls/debuglog_create)

- [`zx_debuglog_read()`](https://fuchsia.dev/reference/syscalls/debuglog_read)