Skip to content

Commit baed13e

Browse files
committed
stashing gbase before new branch
1 parent c6950a5 commit baed13e

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

ci/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ if [[ $1 != @(address|thread|undefined|memory|leak) ]]; then
9494
fi
9595

9696
echo
97-
echo " ldd of $GEMC/bin/gemc:"
97+
echo " ldd of $GEMC/bin/gemc:" >> $compile_log | tee -a
9898

9999
# if on unix, use ldd , if on mac, use otool -L
100100
if [[ "$(uname)" == "Darwin" ]]; then
101101
otool -L $GEMC/bin/gemc || exit 1
102102
else
103-
ldd $GEMC/bin/gemc || exit 1
103+
ldd $GEMC/bin/gemc || exit 1 >> $compile_log | tee -a
104104
fi
105105

gbase/examples/test_gbase.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11

22
#include "gbase.h"
33

4+
constexpr const char* G1_LOGGER = "g1";
5+
6+
47
class g1 : public GBase<g1> {
58
public:
9+
610
int object1 = 2;
711

8-
explicit g1(std::shared_ptr<GOptions> gopt) : GBase(gopt) {
12+
explicit g1(std::shared_ptr<GOptions> gopt) : GBase(gopt, G1_LOGGER) {
913
log->info(0, "hello derived class ", SFUNCTION_NAME);
1014
}
1115

@@ -15,7 +19,7 @@ class g1 : public GBase<g1> {
1519
// returns this example options
1620
GOptions defineOptions() {
1721

18-
GOptions goptions("g1");
22+
GOptions goptions(G1_LOGGER);
1923

2024
// command line switch
2125
goptions.defineSwitch("light", "a switch, this is just an example.");
@@ -27,7 +31,6 @@ int main(int argc, char *argv[]) {
2731

2832
auto gopts = std::make_shared<GOptions>(argc, argv, defineOptions());
2933

30-
3134
g1 obj(gopts);
3235

3336
return EXIT_SUCCESS;

gbase/gbase.cc

Whitespace-only changes.

gbase/gbase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ std::string demangle(const char* name) {
2929
template <typename Derived>
3030
class GBase {
3131
public:
32-
explicit GBase(std::shared_ptr<GOptions> gopt) {
33-
log = std::make_shared<GLogger>(gopt, getDerivedName(), SDERIVED_NAME);
32+
explicit GBase(std::shared_ptr<GOptions> gopt, std::string option_name = "") {
33+
log = std::make_shared<GLogger>(gopt, SDERIVED_NAME, option_name);
3434
log->debug(CONSTRUCTOR, getDerivedName());
3535
}
3636

glogging/glogger.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ class GLogger {
8484

8585
switch (type) {
8686
case NORMAL:
87-
G4cout << KCYN << header_string() << "DEBUG " << oss.str() << RST << G4endl;
87+
G4cout << KCYN << header_string() << "DEBUG: " << oss.str() << RST << G4endl;
8888
break;
8989
case CONSTRUCTOR:
90-
G4cout << KCYN << header_string() << "DEBUG " <<
90+
G4cout << KCYN << header_string() << "DEBUG: " <<
9191
CONSTRUCTORLOG << " " << oss.str() << " " << CONSTRUCTORLOG << RST << G4endl;
9292
break;
9393
case DESTRUCTOR:
94-
G4cout << KCYN << header_string() << "DEBUG " <<
94+
G4cout << KCYN << header_string() << "DEBUG: " <<
9595
DESTRUCTORLOG << " " << oss.str() << " " << DESTRUCTORLOG << RST << G4endl;
9696
break;
9797
}
@@ -118,7 +118,7 @@ class GLogger {
118118
if (level == 0 || (level == 1 && verbosity_level > 0) || (level == 2 && verbosity_level > 1)) {
119119
std::ostringstream oss;
120120
(oss << ... << std::forward<Args>(args));
121-
G4cout << header_string() << "INFO L" << level << " " << oss.str() << G4endl;
121+
G4cout << header_string() << "INFO L" << level << ": " << oss.str() << G4endl;
122122
}
123123
}
124124

@@ -197,6 +197,6 @@ class GLogger {
197197
*/
198198
[[nodiscard]] std::string header_string() const {
199199
log_counter++;
200-
return " [" + description + "]" + " (" + std::to_string(log_counter.load()) + "): ";
200+
return " [ " + description + " - " + std::to_string(log_counter.load()) + " ] ";
201201
}
202202
};

0 commit comments

Comments
 (0)