Danny Robson
2f2dfd1423
This tool is only meant for testing purposes and it's far simpler to only support a single string commandline argument.
37 lines
763 B
C++
37 lines
763 B
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* Copyright 2019, Danny Robson <danny@nerdcruft.net>
|
|
*/
|
|
|
|
#include "../log.hpp"
|
|
|
|
#include <iostream>
|
|
#include <cstdlib>
|
|
|
|
|
|
enum {
|
|
ARG_SELF,
|
|
ARG_LEVEL,
|
|
ARG_VALUE,
|
|
|
|
NUM_ARGS,
|
|
};
|
|
|
|
|
|
int main (int const argc, char const **argv)
|
|
{
|
|
if (argc < NUM_ARGS) {
|
|
fmt::print (stderr, "usage {} <level> <string>\n", argv[ARG_SELF]);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
auto const level = cruft::log::to_level (argv[ARG_LEVEL]);
|
|
auto const value = argv[ARG_VALUE];
|
|
|
|
cruft::log::write (level, "{}", value);
|
|
|
|
return EXIT_SUCCESS;
|
|
} |