IODA Bundle
ODBTarget.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 1996-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #include "odc/ODBTarget.h"
12 
13 #include <iomanip>
14 
15 #include "eckit/runtime/Monitor.h"
16 #include "eckit/log/TimeStamp.h"
17 
18 
19 namespace odc {
20 
21 ODBTarget::ODBTarget(const char* tag, eckit::LogTarget* target)
22 : eckit::WrapperTarget(target),
23  tag_(tag)
24 {}
25 
27 
28  std::ostringstream oss;
29  oss //<< std::setw(3)
30  //<< std::setfill('0')
31  //<< Monitor::instance().self()
32  << "000"
33  << std::setfill(' ') << ' '
34  << eckit::TimeStamp() << ' ';
35 
36  if(tag_ && *tag_) {
37  oss << tag_ << ' ';
38  }
39 
40  const std::string& s (oss.str());
41  const char* p (s.c_str());
42  target_->write(p, p + s.size());
43 }
44 
45 void ODBTarget::print(std::ostream& s) const
46 {
47  s << "ODBTarget";
48 }
49 
51 
52 } // namespace odc
virtual void writeSuffix()
Definition: ODBTarget.cc:50
const char * tag_
Definition: ODBTarget.h:39
void print(std::ostream &s) const
Definition: ODBTarget.cc:45
virtual void writePrefix()
Definition: ODBTarget.cc:26
ODBTarget(const char *tag="", eckit::LogTarget *target=0)
Definition: ODBTarget.cc:21
Definition: ColumnInfo.h:23