blob: bc2e2f1cdb8c0309832692495f92a7536a569b5b [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This header file defines wire format to transfer logs to listening service.
#ifndef LIB_LOG_WRITER_LOGGER_WIRE_FORMAT_H_
#define LIB_LOG_WRITER_LOGGER_WIRE_FORMAT_H_
#include <lib/log/log_writer.h>
#include <zircon/types.h>
#ifdef __cplusplus
extern "C" {
#endif
// Defines max length for storing log_metadata, tags and msgbuffer, redefined from logger.fidl.
#define LOG_MAX_DATAGRAM_LEN 32768
typedef struct log_metadata {
zx_koid_t pid;
zx_koid_t tid;
zx_time_t time;
log_level_t level;
// Increment this field whenever there is a socket write error and client
// drops the log and send it with next log msg.
uint32_t dropped_logs;
} log_metadata_t;
// Packet to transfer over socket.
typedef struct log_packet {
log_metadata_t metadata;
// Contains concatenated tags and message and a null terminating character at
// the end.
char data[LOG_MAX_DATAGRAM_LEN - sizeof(log_metadata_t)];
} log_packet_t;
#ifdef __cplusplus
}
#endif
#endif // LIB_LOG_WRITER_LOGGER_WIRE_FORMAT_H_