1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
6 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. See the AUTHORS file for names of contributors.
10 // Logger implementation that can be shared by all environments
11 // where enough posix functionality is available.
21 #include "rocksdb/env.h"
23 namespace ROCKSDB_NAMESPACE
{
27 class WinLogger
: public ROCKSDB_NAMESPACE::Logger
{
29 WinLogger(uint64_t (*gettid
)(), SystemClock
* clock
, HANDLE file
,
30 const InfoLogLevel log_level
= InfoLogLevel::ERROR_LEVEL
);
34 WinLogger(const WinLogger
&) = delete;
36 WinLogger
& operator=(const WinLogger
&) = delete;
38 void Flush() override
;
40 using ROCKSDB_NAMESPACE::Logger::Logv
;
41 void Logv(const char* format
, va_list ap
) override
;
43 size_t GetLogFileSize() const override
;
45 void DebugWriter(const char* str
, int len
);
48 Status
CloseImpl() override
;
52 uint64_t (*gettid_
)(); // Return the thread id for the current thread
53 std::atomic_size_t log_size_
;
54 std::atomic_uint_fast64_t last_flush_micros_
;
58 Status
CloseInternal();
60 const static uint64_t flush_every_seconds_
= 5;
64 } // namespace ROCKSDB_NAMESPACE