AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
writer.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 <iostream>
23
24#include "logger/levels.hpp"
25#include "logger/formatter/messageFormatter.hpp"
26
27
28namespace anch::logger {
29
35 class Writer {
36 // Attributes +
37 protected:
39 std::ostream* _output;
40
43
44 private:
46 std::string _fileName;
47
49 unsigned int _maxSize;
50
52 int _maxIndex;
53
55 int _fileIndex;
56 // Attributes -
57
58 public:
59 // Constructors +
68 Writer(const std::string& fileName,
69 const std::string& linePattern,
70 unsigned int maxSize = 0,
71 int maxIndex = 0);
72
79 Writer(std::ostream* output, const std::string& linePattern);
80 // Constructors -
81
82 // Destructor +
86 virtual ~Writer();
87 // Destructor -
88
89 public:
97 virtual void write(const std::string& category,
98 const anch::logger::Level& level,
99 const std::string& message);
100
101 protected:
107 bool rotate() const;
108
113
114 };
115
116}
117
118#include "logger/impl/writter.hpp"
bool rotate() const
std::ostream * _output
Definition writer.hpp:39
Writer(const std::string &fileName, const std::string &linePattern, unsigned int maxSize=0, int maxIndex=0)
virtual void write(const std::string &category, const anch::logger::Level &level, const std::string &message)
anch::logger::formatter::MessageFormatter _formatter
Definition writer.hpp:42
Writer(std::ostream *output, const std::string &linePattern)
Definition messageFormatter.hpp:46
Logger namespace.
Definition anchDateFormatter.hpp:27
Level
Definition levels.hpp:32