Commit 57ab5a216fd96373b40eb03c50b46366a4784f5b
1 parent
d1bca57e
Enhance logging.
Showing
2 changed files
with
27 additions
and
25 deletions
src/ctbin/ctbin.cpp
| ... | ... | @@ -241,15 +241,27 @@ void ctbin::run(void) |
| 241 | 241 | // Loop over all observations in the container |
| 242 | 242 | for (int i = 0; i < m_obs.size(); ++i) { |
| 243 | 243 | |
| 244 | + // Write header for observation | |
| 245 | + if (logTerse()) { | |
| 246 | + std::string header = m_obs[i]->instrument() + " observation"; | |
| 247 | + if (m_obs[i]->name().length() > 1) { | |
| 248 | + header += " \"" + m_obs[i]->name() + "\""; | |
| 249 | + } | |
| 250 | + if (m_obs[i]->id().length() > 1) { | |
| 251 | + header += " (id=" + m_obs[i]->id() +")"; | |
| 252 | + } | |
| 253 | + log.header3(header); | |
| 254 | + } | |
| 255 | + | |
| 244 | 256 | // Get CTA observation |
| 245 | 257 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 246 | 258 | |
| 247 | 259 | // Skip observation if it's not CTA |
| 248 | 260 | if (obs == NULL) { |
| 249 | 261 | if (logTerse()) { |
| 250 | - log << "Warning: Skipping "+m_obs[i]->instrument(); | |
| 251 | - log << " observation \""; | |
| 252 | - log << m_obs[i]->name() << "\"" << std::endl; | |
| 262 | + log << " Skipping "; | |
| 263 | + log << m_obs[i]->instrument(); | |
| 264 | + log << " observation" << std::endl; | |
| 253 | 265 | } |
| 254 | 266 | continue; |
| 255 | 267 | } |
| ... | ... | @@ -257,22 +269,13 @@ void ctbin::run(void) |
| 257 | 269 | // Skip observation if we have a binned observation |
| 258 | 270 | if (obs->eventtype() == "CountsCube") { |
| 259 | 271 | if (logTerse()) { |
| 260 | - log << "Warning: Skipping binned observation \""; | |
| 261 | - log << obs->name()+"\"" << std::endl; | |
| 272 | + log << " Skipping binned "; | |
| 273 | + log << obs->instrument(); | |
| 274 | + log << " observation" << std::endl; | |
| 262 | 275 | } |
| 263 | 276 | continue; |
| 264 | 277 | } |
| 265 | 278 | |
| 266 | - // Write header for observation | |
| 267 | - if (logTerse()) { | |
| 268 | - if (obs->name().length() > 1) { | |
| 269 | - log.header3("Observation "+obs->name()); | |
| 270 | - } | |
| 271 | - else { | |
| 272 | - log.header3("Observation"); | |
| 273 | - } | |
| 274 | - } | |
| 275 | - | |
| 276 | 279 | // Fill the cube |
| 277 | 280 | fill_cube(obs); |
| 278 | 281 | ... | ... |
src/ctobssim/ctobssim.cpp
| ... | ... | @@ -326,12 +326,14 @@ void ctobssim::run(void) |
| 326 | 326 | |
| 327 | 327 | // Write header for observation |
| 328 | 328 | if (logTerse()) { |
| 329 | + std::string header = m_obs[i]->instrument() + " observation"; | |
| 329 | 330 | if (m_obs[i]->name().length() > 1) { |
| 330 | - wrklog.header3("Observation "+m_obs[i]->name()); | |
| 331 | + header += " \"" + m_obs[i]->name() + "\""; | |
| 331 | 332 | } |
| 332 | - else { | |
| 333 | - wrklog.header3("Observation"); | |
| 333 | + if (m_obs[i]->id().length() > 1) { | |
| 334 | + header += " (id=" + m_obs[i]->id() +")"; | |
| 334 | 335 | } |
| 336 | + wrklog.header3(header); | |
| 335 | 337 | } |
| 336 | 338 | |
| 337 | 339 | // Get pointer on CTA observation |
| ... | ... | @@ -340,10 +342,9 @@ void ctobssim::run(void) |
| 340 | 342 | // Skip observation if it's not CTA |
| 341 | 343 | if (obs == NULL) { |
| 342 | 344 | if (logTerse()) { |
| 343 | - wrklog << " Skipping "+m_obs[i]->instrument(); | |
| 344 | - wrklog << " observation \""; | |
| 345 | - wrklog << m_obs[i]->name() << "\""; | |
| 346 | - wrklog << " (id=" << m_obs[i]->id() << ")" << std::endl; | |
| 345 | + wrklog << " Skipping "; | |
| 346 | + wrklog << m_obs[i]->instrument(); | |
| 347 | + wrklog << " observation" << std::endl; | |
| 347 | 348 | } |
| 348 | 349 | continue; |
| 349 | 350 | } |
| ... | ... | @@ -353,9 +354,7 @@ void ctobssim::run(void) |
| 353 | 354 | if (logTerse()) { |
| 354 | 355 | wrklog << " Skipping binned "; |
| 355 | 356 | wrklog << obs->instrument(); |
| 356 | - wrklog << " observation \""; | |
| 357 | - wrklog << obs->name()+"\""; | |
| 358 | - wrklog << " (id=" << obs->id() << ")" << std::endl; | |
| 357 | + wrklog << " observation" << std::endl; | |
| 359 | 358 | } |
| 360 | 359 | continue; |
| 361 | 360 | } | ... | ... |