AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
loggerFactory.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2012 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <map>
23#include <vector>
24#include <cstdint>
25
26#include "logger/loggerConfiguration.hpp"
27#include "logger/logger.hpp"
28#include "logger/writer.hpp"
29#include "resource/resource.hpp"
30#include "singleton.hpp"
31
32
33namespace anch::logger {
34
44 class LoggerFactory: public anch::Singleton<LoggerFactory> {
45 friend class anch::Singleton<LoggerFactory>;
46
47 public:
49 static std::string CONF_FILE;
50
51 private:
52 // Attributes +
54 std::vector<anch::logger::LoggerConfiguration> _loggersConfig;
55
57 std::vector<anch::logger::Logger*> _loggers;
58 // Attributes -
59
60 private:
61 // Constructor +
65 LoggerFactory();
66 // Constructor -
67
68 // Destructor +
73 virtual ~LoggerFactory();
74 // Destructor -
75
76 public:
77 // Methods +
86 static const anch::logger::Logger& getLogger(const std::string& loggerName);
87
88 private:
97 anch::logger::Writer* createWriterInstance(bool threadSafe, bool lowPriority, std::ostream* out, const std::string& pattern);
98
109 anch::logger::Writer* createWriterInstance(bool threadSafe, bool lowPriority, const std::string& path, const std::string& pattern, uint32_t maxSize, int maxIndex);
110
117 void initializeWriters(std::map<std::string,anch::logger::Writer*>& writers, const anch::resource::Resource& resource);
118
125 void initializeLoggersConfiguration(const std::map<std::string,anch::logger::Writer*>& writers, const anch::resource::Resource& resource);
126
130 void loadDefaultConfiguration();
131 // Methods -
132
133 };
134
135}
Meyers' singleton implementation.
Definition singleton.hpp:34
static const anch::logger::Logger & getLogger(const std::string &loggerName)
static std::string CONF_FILE
Definition loggerFactory.hpp:49
Definition logger.hpp:45
Definition writer.hpp:35
Definition resource.hpp:35
Logger namespace.
Definition anchDateFormatter.hpp:27
Resources namespace.
Definition configurationFileParser.hpp:28