2019-10-10 15:11:02 +11:00
|
|
|
/*
|
|
|
|
* 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>
|
|
|
|
*/
|
|
|
|
|
2020-01-01 06:55:11 +11:00
|
|
|
#include "../log.hpp"
|
2019-10-10 15:11:02 +11:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ARG_SELF,
|
|
|
|
ARG_LEVEL,
|
2023-11-19 10:37:05 +11:00
|
|
|
ARG_VALUE,
|
2019-10-10 15:11:02 +11:00
|
|
|
|
2023-11-19 10:37:05 +11:00
|
|
|
NUM_ARGS,
|
2019-10-10 15:11:02 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int main (int const argc, char const **argv)
|
|
|
|
{
|
2023-11-19 10:37:05 +11:00
|
|
|
if (argc < NUM_ARGS) {
|
|
|
|
fmt::print (stderr, "usage {} <level> <string>\n", argv[ARG_SELF]);
|
2019-10-10 15:11:02 +11:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2023-11-19 10:37:05 +11:00
|
|
|
auto const level = cruft::log::to_level (argv[ARG_LEVEL]);
|
|
|
|
auto const value = argv[ARG_VALUE];
|
2019-10-10 15:11:02 +11:00
|
|
|
|
2023-11-19 10:37:05 +11:00
|
|
|
cruft::log::write (level, "{}", value);
|
2019-10-10 15:11:02 +11:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|