Darwin Neuroevolution Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
logging.h
1 // Copyright 2018 The Darwin Neuroevolution Framework Authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include "format.h"
18 #include "pubsub.h"
19 
20 #include <stdarg.h>
21 #include <string>
22 #include <utility>
23 using namespace std;
24 
25 // CONSIDER: log::verbose(), log::info(), log::exception(), log::fatal() ?
26 
27 namespace core {
28 
31  static PubSub<string>* output = new PubSub<string>;
32  return output;
33 }
34 
37 void fatalMessage(const char* format, ...);
38 
39 void vFatalMessage(const char* format, va_list arg_list);
40 
41 void log(const string& message);
42 
44 template <class... ARGS>
45 void log(const char* format_string, ARGS&&... args) {
46  log(core::format(format_string, std::forward<ARGS>(args)...));
47 }
48 
49 void initLogging();
50 
51 } // namespace core
Generic utilities.
Definition: exception.h:24
STL namespace.
PubSub< string > * consoleOutput()
Console output messages.
Definition: logging.h:30
string format(const char *format_string, ARGS &&... args)
A minimalistic string formatting built on top of the C-formatting facilities (xprintf formatting) ...
Definition: format.h:68