Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
a4602021
Commit
a4602021
authored
Oct 25, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed private members of file_helper
parent
dbe5c17a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
include/spdlog/details/file_helper-inl.h
include/spdlog/details/file_helper-inl.h
+9
-9
include/spdlog/details/file_helper.h
include/spdlog/details/file_helper.h
+3
-3
No files found.
include/spdlog/details/file_helper-inl.h
View file @
a4602021
...
@@ -30,9 +30,9 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
...
@@ -30,9 +30,9 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
close
();
close
();
auto
*
mode
=
truncate
?
SPDLOG_FILENAME_T
(
"wb"
)
:
SPDLOG_FILENAME_T
(
"ab"
);
auto
*
mode
=
truncate
?
SPDLOG_FILENAME_T
(
"wb"
)
:
SPDLOG_FILENAME_T
(
"ab"
);
auto
folder_name
=
os
::
dir_name
(
fname
);
auto
folder_name
=
os
::
dir_name
(
fname
);
_filename
=
fname
;
filename_
=
fname
;
for
(
int
tries
=
0
;
tries
<
open_tries
;
++
tries
)
for
(
int
tries
=
0
;
tries
<
open_tries
_
;
++
tries
)
{
{
if
(
!
folder_name
.
empty
())
if
(
!
folder_name
.
empty
())
{
{
...
@@ -44,19 +44,19 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
...
@@ -44,19 +44,19 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
return
;
return
;
}
}
details
::
os
::
sleep_for_millis
(
open_interval
);
details
::
os
::
sleep_for_millis
(
open_interval
_
);
}
}
SPDLOG_THROW
(
spdlog_ex
(
"Failed opening file "
+
os
::
filename_to_str
(
_filename
)
+
" for writing"
,
errno
));
SPDLOG_THROW
(
spdlog_ex
(
"Failed opening file "
+
os
::
filename_to_str
(
filename_
)
+
" for writing"
,
errno
));
}
}
SPDLOG_INLINE
void
file_helper
::
reopen
(
bool
truncate
)
SPDLOG_INLINE
void
file_helper
::
reopen
(
bool
truncate
)
{
{
if
(
_filename
.
empty
())
if
(
filename_
.
empty
())
{
{
SPDLOG_THROW
(
spdlog_ex
(
"Failed re opening file - was not opened before"
));
SPDLOG_THROW
(
spdlog_ex
(
"Failed re opening file - was not opened before"
));
}
}
open
(
_filename
,
truncate
);
this
->
open
(
filename_
,
truncate
);
}
}
SPDLOG_INLINE
void
file_helper
::
flush
()
SPDLOG_INLINE
void
file_helper
::
flush
()
...
@@ -79,7 +79,7 @@ SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf)
...
@@ -79,7 +79,7 @@ SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf)
auto
data
=
buf
.
data
();
auto
data
=
buf
.
data
();
if
(
std
::
fwrite
(
data
,
1
,
msg_size
,
fd_
)
!=
msg_size
)
if
(
std
::
fwrite
(
data
,
1
,
msg_size
,
fd_
)
!=
msg_size
)
{
{
SPDLOG_THROW
(
spdlog_ex
(
"Failed writing to file "
+
os
::
filename_to_str
(
_filename
),
errno
));
SPDLOG_THROW
(
spdlog_ex
(
"Failed writing to file "
+
os
::
filename_to_str
(
filename_
),
errno
));
}
}
}
}
...
@@ -87,14 +87,14 @@ SPDLOG_INLINE size_t file_helper::size() const
...
@@ -87,14 +87,14 @@ SPDLOG_INLINE size_t file_helper::size() const
{
{
if
(
fd_
==
nullptr
)
if
(
fd_
==
nullptr
)
{
{
SPDLOG_THROW
(
spdlog_ex
(
"Cannot use size() on closed file "
+
os
::
filename_to_str
(
_filename
)));
SPDLOG_THROW
(
spdlog_ex
(
"Cannot use size() on closed file "
+
os
::
filename_to_str
(
filename_
)));
}
}
return
os
::
filesize
(
fd_
);
return
os
::
filesize
(
fd_
);
}
}
SPDLOG_INLINE
const
filename_t
&
file_helper
::
filename
()
const
SPDLOG_INLINE
const
filename_t
&
file_helper
::
filename
()
const
{
{
return
_filename
;
return
filename_
;
}
}
//
//
...
...
include/spdlog/details/file_helper.h
View file @
a4602021
...
@@ -46,10 +46,10 @@ public:
...
@@ -46,10 +46,10 @@ public:
static
std
::
tuple
<
filename_t
,
filename_t
>
split_by_extension
(
const
filename_t
&
fname
);
static
std
::
tuple
<
filename_t
,
filename_t
>
split_by_extension
(
const
filename_t
&
fname
);
private:
private:
const
int
open_tries
=
5
;
const
int
open_tries
_
=
5
;
const
int
open_interval
=
10
;
const
int
open_interval
_
=
10
;
std
::
FILE
*
fd_
{
nullptr
};
std
::
FILE
*
fd_
{
nullptr
};
filename_t
_filename
;
filename_t
filename_
;
};
};
}
// namespace details
}
// namespace details
}
// namespace spdlog
}
// namespace spdlog
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment