37 lines
771 B
C++
37 lines
771 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 <cruft/util/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;
|
|
} |