ClickHouse/base/poco/Foundation/include/Poco/CompressedLogFile.h
Robert Schulze b79ead9c84
Move poco to base/poco/ (#46075)
* Replicate poco into base/poco/

* De-register poco submodule

* Build poco from ClickHouse

* Exclude poco from stylecheck

* Exclude poco from whitespace check

* Exclude poco from typo check

* Remove x bit from sources/headers (the style check complained)

* Exclude poco from duplicate include check

* Fix fasttest

* Remove contrib/poco-cmake/*

* Simplify poco build descriptions

* Remove poco stuff not used by ClickHouse

* Glob poco sources

* Exclude poco from clang-tidy
2023-02-08 12:04:11 +01:00

61 lines
1.1 KiB
C++

//
// CompressedLogFile.h
//
// Library: Foundation
// Package: Logging
// Module: CompressedLogFile
//
// Definition of the LogFile class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_CompressedLogFile_INCLUDED
#define Foundation_CompressedLogFile_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/LogFile.h"
#include "Poco/Buffer.h"
#include <lz4.h>
#include <lz4frame.h>
namespace Poco {
class Foundation_API CompressedLogFile: public LogFile
{
public:
CompressedLogFile(const std::string& path);
/// Allocates buffer and initializes compession state.
~CompressedLogFile();
/// Destoys CompressedLogFile
void write(const std::string& text, bool flush = true);
/// Writes the given text to the compressed log file.
/// If flush is true, the text will be immediately
/// flushed to the file.
private:
Poco::Buffer<char> _buffer;
LZ4F_preferences_t _kPrefs;
LZ4F_compressionContext_t _ctx;
};
} // namespace Poco
#endif // Foundation_CompressedLogFile_INCLUDED