11// Copyright The OpenTelemetry Authors
22// SPDX-License-Identifier: Apache-2.0
33
4+ #include < nlohmann/json.hpp>
5+
46#include < limits.h>
57#include < atomic>
68#include < chrono>
1214#include < fstream>
1315#include < functional>
1416#include < mutex>
15- #include < nlohmann/json.hpp>
1617#include < ratio>
1718#include < string>
1819#include < thread>
@@ -1028,21 +1029,21 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
10281029
10291030 MaybeRotateLog (data.size ());
10301031
1031- std::shared_ptr<FILE> out = OpenLogFile (true );
1032+ std::shared_ptr<std:: FILE> out = OpenLogFile (true );
10321033 if (!out)
10331034 {
10341035 return ;
10351036 }
10361037
1037- fwrite (data.data (), 1 , data.size (), out.get ());
1038+ std:: fwrite (data.data (), 1 , data.size (), out.get ());
10381039
10391040 {
10401041 std::lock_guard<std::mutex> lock_guard{file_->file_lock };
10411042
10421043 file_->record_count += record_count;
10431044
10441045 // Pipe file size always returns 0, we ignore the size limit of it.
1045- auto written_size = ftell (out.get ());
1046+ auto written_size = std:: ftell (out.get ());
10461047 if (written_size >= 0 )
10471048 {
10481049 file_->written_size = static_cast <std::size_t >(written_size);
@@ -1054,7 +1055,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
10541055 {
10551056 file_->left_flush_record_count = options_.flush_count ;
10561057
1057- fflush (out.get ());
1058+ std:: fflush (out.get ());
10581059
10591060 file_->flushed_record_count .store (file_->record_count .load (std::memory_order_acquire),
10601061 std::memory_order_release);
@@ -1216,7 +1217,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
12161217 OpenLogFile (false );
12171218 }
12181219
1219- std::shared_ptr<FILE> OpenLogFile (bool destroy_content)
1220+ std::shared_ptr<std:: FILE> OpenLogFile (bool destroy_content)
12201221 {
12211222 std::lock_guard<std::mutex> lock_guard{file_->file_lock };
12221223
@@ -1238,8 +1239,6 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
12381239 }
12391240 file_path[file_path_size] = 0 ;
12401241
1241- std::shared_ptr<FILE> of = std::make_shared<FILE>();
1242-
12431242 std::string directory_name = FileSystemUtil::DirName (file_path);
12441243 if (!directory_name.empty ())
12451244 {
@@ -1294,10 +1293,10 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
12941293 << " failed with pattern: " << options_.file_pattern << hint);
12951294 return nullptr ;
12961295 }
1297- of = std::shared_ptr<std::FILE>(new_file, fclose);
1296+ std::shared_ptr<std::FILE> of = std::shared_ptr<std::FILE>(new_file, fclose);
12981297
1299- fseek (of.get (), 0 , SEEK_END);
1300- file_->written_size = static_cast <size_t >(ftell (of.get ()));
1298+ std:: fseek (of.get (), 0 , SEEK_END);
1299+ file_->written_size = static_cast <size_t >(std:: ftell (of.get ()));
13011300
13021301 file_->current_file = of;
13031302 file_->last_checkpoint = std::chrono::system_clock::to_time_t (std::chrono::system_clock::now ());
@@ -1513,7 +1512,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
15131512
15141513 if (concurrency_file->current_file )
15151514 {
1516- fflush (concurrency_file->current_file .get ());
1515+ std:: fflush (concurrency_file->current_file .get ());
15171516 }
15181517
15191518 concurrency_file->flushed_record_count .store (current_record_count,
@@ -1568,7 +1567,7 @@ class OPENTELEMETRY_LOCAL_SYMBOL OtlpFileSystemBackend : public OtlpFileAppender
15681567 std::size_t rotate_index;
15691568 std::size_t written_size;
15701569 std::size_t left_flush_record_count;
1571- std::shared_ptr<FILE> current_file;
1570+ std::shared_ptr<std:: FILE> current_file;
15721571 std::mutex file_lock;
15731572 std::time_t last_checkpoint;
15741573 std::string file_path;
0 commit comments