mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-07 17:32:14 +00:00
Reduce STDERR logging to only WARNING and above.
INFO logs are now only viewable in the log file, which is not written by default. A new command line option --log-file can be used to control where the log file is written. INFO logs can be written to STDERR if --log-all-to-stderr is passed.
This commit is contained in:
parent
0e4148518a
commit
3b9371f4b5
@ -986,11 +986,14 @@ void LanguageServerMain(const std::string& bin_name,
|
|||||||
// MAIN ////////////////////////////////////////////////////////////////////////
|
// MAIN ////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
loguru::init(argc, argv);
|
std::unordered_map<std::string, std::string> options =
|
||||||
loguru::add_file("cquery_diagnostics.log", loguru::Truncate,
|
ParseOptions(argc, argv);
|
||||||
loguru::Verbosity_MAX);
|
|
||||||
|
if (!HasOption(options, "--log-all-to-stderr"))
|
||||||
|
loguru::g_stderr_verbosity = loguru::Verbosity_WARNING;
|
||||||
|
|
||||||
loguru::g_flush_interval_ms = 0;
|
loguru::g_flush_interval_ms = 0;
|
||||||
loguru::g_stderr_verbosity = 1;
|
loguru::init(argc, argv);
|
||||||
|
|
||||||
MultiQueueWaiter waiter;
|
MultiQueueWaiter waiter;
|
||||||
IpcManager::CreateInstance(&waiter);
|
IpcManager::CreateInstance(&waiter);
|
||||||
@ -1003,19 +1006,21 @@ int main(int argc, char** argv) {
|
|||||||
PlatformInit();
|
PlatformInit();
|
||||||
IndexInit();
|
IndexInit();
|
||||||
|
|
||||||
std::unordered_map<std::string, std::string> options =
|
|
||||||
ParseOptions(argc, argv);
|
|
||||||
|
|
||||||
bool print_help = true;
|
bool print_help = true;
|
||||||
|
|
||||||
|
if (HasOption(options, "--log-file")) {
|
||||||
|
loguru::add_file(options["--log-file"].c_str(), loguru::Truncate,
|
||||||
|
loguru::Verbosity_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HasOption(options, "--log-stdin-stdout-to-stderr"))
|
||||||
|
g_log_stdin_stdout_to_stderr = true;
|
||||||
|
|
||||||
if (HasOption(options, "--clang-sanity-check")) {
|
if (HasOption(options, "--clang-sanity-check")) {
|
||||||
print_help = false;
|
print_help = false;
|
||||||
ClangSanityCheck();
|
ClangSanityCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasOption(options, "--log-stdin-stdout-to-stderr"))
|
|
||||||
g_log_stdin_stdout_to_stderr = true;
|
|
||||||
|
|
||||||
if (HasOption(options, "--test-unit")) {
|
if (HasOption(options, "--test-unit")) {
|
||||||
print_help = false;
|
print_help = false;
|
||||||
doctest::Context context;
|
doctest::Context context;
|
||||||
@ -1043,36 +1048,40 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (print_help) {
|
if (print_help) {
|
||||||
std::cout << R"help(cquery help:
|
std::cout << R"help(cquery is a low-latency C++ language server.
|
||||||
|
|
||||||
cquery is a low-latency C++ language server.
|
Command line options:
|
||||||
|
--language-server
|
||||||
|
Run as a language server. This implements the language server
|
||||||
|
spec over STDIN and STDOUT.
|
||||||
|
--test-unit Run unit tests.
|
||||||
|
--test-index Run index tests.
|
||||||
|
--log-stdin-stdout-to-stderr
|
||||||
|
Print stdin and stdout messages to stderr. This is a aid for
|
||||||
|
developing new language clients, as it makes it easier to figure
|
||||||
|
out how the client is interacting with cquery.
|
||||||
|
--log-file <absoulte_path>
|
||||||
|
Emit diagnostic logging to the given path, which is taken
|
||||||
|
literally, ie, it will be relative to the current working
|
||||||
|
directory.
|
||||||
|
--log-all-to-stderr
|
||||||
|
Write all log messages to STDERR.
|
||||||
|
--clang-sanity-check
|
||||||
|
Run a simple index test. Verifies basic clang functionality.
|
||||||
|
Needs to be executed from the cquery root checkout directory.
|
||||||
|
--help Print this help information.
|
||||||
|
|
||||||
General:
|
Configuration:
|
||||||
--help Print this help information.
|
When opening up a directory, cquery will look for a compile_commands.json file
|
||||||
--language-server
|
emitted by your preferred build system. If not present, cquery will use a
|
||||||
Run as a language server. This implements the language
|
recursive directory listing instead. Command line flags can be provided by
|
||||||
server spec over STDIN and STDOUT.
|
adding a file named `.cquery` in the top-level directory. Each line in that
|
||||||
--test-unit Run unit tests.
|
file is a separate argument.
|
||||||
--test-index Run index tests.
|
|
||||||
--log-stdin-stdout-to-stderr
|
|
||||||
Print stdin and stdout messages to stderr. This is a aid for
|
|
||||||
developing new language clients, as it makes it easier to
|
|
||||||
figure out how the client is interacting with cquery.
|
|
||||||
--clang-sanity-check
|
|
||||||
Run a simple index test. Verifies basic clang functionality.
|
|
||||||
Needs to be executed from the cquery root checkout directory.
|
|
||||||
|
|
||||||
Configuration:
|
There are also a number of configuration options available when initializing
|
||||||
When opening up a directory, cquery will look for a compile_commands.json
|
the language server - your editor should have tooling to describe those
|
||||||
file emitted by your preferred build system. If not present, cquery will
|
options. See |Config| in this source code for a detailed list of all
|
||||||
use a recursive directory listing instead. Command line flags can be
|
currently supported options.
|
||||||
provided by adding a file named `.cquery` in the top-level directory. Each
|
|
||||||
line in that file is a separate argument.
|
|
||||||
|
|
||||||
There are also a number of configuration options available when
|
|
||||||
initializing the language server - your editor should have tooling to
|
|
||||||
describe those options. See |Config| in this source code for a detailed
|
|
||||||
list of all currently supported options.
|
|
||||||
)help";
|
)help";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user