blob: 88b123707f238428772e8ea9c8c909b735c8ffbc [file] [log] [blame]
// Copyright 2017 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include <vm_protos/proto_bindings/vm_host.grpc.pb.h>
namespace vm_tools::syslog {
// Parses |severity| and returns a string that can be used as a valid PRI part
// of a syslog message.
std::string ParseProtoSeverity(vm_tools::LogSeverity severity);
// Parses |timestamp| into an RFC3164 compliant string that can be included as
// part of a syslog message.
std::string ParseProtoTimestamp(const vm_tools::Timestamp& timestamp);
// Scrubs |content| and returns a valid UTF-8 string. Assumes |content| is
// encoded as UTF-8. Invalid code points are replaced with (U+fffd). Control
// characters and other valid but non-character code points are converted into
// octal numbers with a minimum width of 3 digits and prefixed with '#'. For
// example if the BEL character (U+0007) appears in |content| it will be
// converted to "#007".
std::string ScrubProtoContent(const std::string& content);
} // namespace vm_tools::syslog