Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Libhdbpp Timescale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
LOFAR2.0
Libhdbpp Timescale
Commits
4e8e7c53
Commit
4e8e7c53
authored
5 years ago
by
Stuart Mark James
Browse files
Options
Downloads
Patches
Plain Diff
Tango exceptions now include filename where the error is raised
parent
b8a4401a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/LibUtils.hpp
+17
-2
17 additions, 2 deletions
src/LibUtils.hpp
test/AttributeTraitsTests.cpp
+4
-0
4 additions, 0 deletions
test/AttributeTraitsTests.cpp
with
21 additions
and
2 deletions
src/LibUtils.hpp
+
17
−
2
View file @
4e8e7c53
...
@@ -59,7 +59,7 @@ std::ostream &operator<<(std::ostream &os, Tango::CmdArgType type);
...
@@ -59,7 +59,7 @@ std::ostream &operator<<(std::ostream &os, Tango::CmdArgType type);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Tango
::
AttrQuality
quality
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Tango
::
AttrQuality
quality
);
// SPDLOG config and setup
// SPDLOG config and setup
const
string
LibLoggerName
=
"hdbpp
_internal
"
;
const
string
LibLoggerName
=
"hdbpp"
;
struct
LogConfigurator
struct
LogConfigurator
{
{
...
@@ -68,10 +68,25 @@ struct LogConfigurator
...
@@ -68,10 +68,25 @@ struct LogConfigurator
static
void
setLoggingLevel
(
spdlog
::
level
::
level_enum
level
);
static
void
setLoggingLevel
(
spdlog
::
level
::
level_enum
level
);
};
};
// get the file name from the __FILE__ variable for error messages
constexpr
auto
*
getFileName
(
const
char
*
const
path
)
{
const
auto
*
start_position
=
path
;
for
(
const
auto
*
current_character
=
path
;
*
current_character
!=
'\0'
;
++
current_character
)
if
(
*
current_character
==
'\\'
||
*
current_character
==
'/'
)
start_position
=
current_character
;
if
(
start_position
!=
path
)
++
start_position
;
return
start_position
;
}
// Macros to get the location for reporting errors
// Macros to get the location for reporting errors
#define S1(x) #x
#define S1(x) #x
#define S2(x) S1(x)
#define S2(x) S1(x)
#define LOCATION_INFO string(__func__) + ":" S2(__LINE__)
#define LOCATION_INFO
string(getFileName(__FILE__)) + ":" +
string(__func__) + ":" S2(__LINE__)
};
// namespace hdbpp_internal
};
// namespace hdbpp_internal
#endif // _LIBUTILS_H
#endif // _LIBUTILS_H
This diff is collapsed.
Click to expand it.
test/AttributeTraitsTests.cpp
+
4
−
0
View file @
4e8e7c53
...
@@ -20,11 +20,15 @@
...
@@ -20,11 +20,15 @@
#include
"AttributeTraits.hpp"
#include
"AttributeTraits.hpp"
#include
"catch2/catch.hpp"
#include
"catch2/catch.hpp"
#include
"LibUtils.hpp"
using
namespace
std
;
using
namespace
std
;
using
namespace
hdbpp_internal
;
using
namespace
hdbpp_internal
;
SCENARIO
(
"Attribute format returns expected results"
,
"[attribute-traits]"
)
SCENARIO
(
"Attribute format returns expected results"
,
"[attribute-traits]"
)
{
{
cout
<<
LOCATION_INFO
<<
endl
;
GIVEN
(
"Constructed AttributeTraits as an Array"
)
GIVEN
(
"Constructed AttributeTraits as an Array"
)
{
{
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
AttributeTraits
traits
{
Tango
::
READ
,
Tango
::
SPECTRUM
,
Tango
::
DEV_BOOLEAN
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment