Logger.h
author František Kučera <franta-hg@frantovo.cz>
Mon, 04 Jan 2021 15:45:12 +0100
branchv_0
changeset 12 15d87fdd6e6c
permissions -rw-r--r--
use Logger instead of messing with STDIO directly
franta-hg@12
     1
/**
franta-hg@12
     2
 * DJM-Fix
franta-hg@12
     3
 * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
franta-hg@12
     4
 *
franta-hg@12
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@12
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@12
     7
 * the Free Software Foundation, version 3 of the License.
franta-hg@12
     8
 *
franta-hg@12
     9
 * This program is distributed in the hope that it will be useful,
franta-hg@12
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@12
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@12
    12
 * GNU General Public License for more details.
franta-hg@12
    13
 *
franta-hg@12
    14
 * You should have received a copy of the GNU General Public License
franta-hg@12
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@12
    16
 */
franta-hg@12
    17
#pragma once
franta-hg@12
    18
franta-hg@12
    19
#include <iostream>
franta-hg@12
    20
franta-hg@12
    21
namespace djmfix {
franta-hg@12
    22
namespace logging {
franta-hg@12
    23
franta-hg@12
    24
enum class Level {
franta-hg@12
    25
	SEVERE,
franta-hg@12
    26
	WARNING,
franta-hg@12
    27
	INFO,
franta-hg@12
    28
	CONFIG,
franta-hg@12
    29
	FINE,
franta-hg@12
    30
	FINER,
franta-hg@12
    31
	FINEST,
franta-hg@12
    32
};
franta-hg@12
    33
franta-hg@12
    34
class Logger {
franta-hg@12
    35
public:
franta-hg@12
    36
	virtual ~Logger() = default;
franta-hg@12
    37
	virtual void log(Level level, const std::string& message) = 0;
franta-hg@12
    38
};
franta-hg@12
    39
franta-hg@12
    40
Logger* create(std::ostream& output, Level minLevel);
franta-hg@12
    41
Logger* blackhole();
franta-hg@12
    42
franta-hg@12
    43
}
franta-hg@12
    44
}