osquery-1/include/osquery/logger.h

74 lines
2.2 KiB
C
Raw Normal View History

2014-07-31 00:35:19 +00:00
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
2014-07-31 00:35:19 +00:00
#include <future>
#include <string>
#include <vector>
#include "osquery/status.h"
2014-07-31 00:35:19 +00:00
#include "osquery/database.h"
2014-08-15 07:25:30 +00:00
namespace osquery {
2014-07-31 00:35:19 +00:00
/**
* @brief A string which represents the default logger receiver
2014-09-15 20:02:23 +00:00
*
* The logger plugin that you use to define your config receiver can be
* defined via a command-line flag, however, if you don't define a logger
* plugin to use via the command-line, then the logger receiver which is
* represented by the string stored kDefaultLogReceiverName will be used.
2014-09-15 20:02:23 +00:00
*/
2014-07-31 00:35:19 +00:00
extern const std::string kDefaultLogReceiverName;
/**
* @brief Log a string using the default logger receiver.
2014-09-15 20:02:23 +00:00
*
* Note that this method should only be used to log results. If you'd like to
* log normal osquery operations, use Google Logging.
2014-09-15 20:02:23 +00:00
*
* @param s the string to log
2014-09-15 20:02:23 +00:00
*
* @return an instance of osquery::Status, indicating the success or failure
* of the operation.
2014-09-15 20:02:23 +00:00
*/
osquery::Status logString(const std::string& s);
2014-09-15 20:02:23 +00:00
/**
* @brief Log a string using a specific logger receiver.
2014-09-15 20:02:23 +00:00
*
* Note that this method should only be used to log results. If you'd like to
* log normal osquery operations, use Google Logging.
2014-09-15 20:02:23 +00:00
*
* @param s the string to log
* @param receiver a string representing the log receiver to use
2014-09-15 20:02:23 +00:00
*
* @return an instance of osquery::Status, indicating the success or failure
* of the operation.
2014-09-15 20:02:23 +00:00
*/
2014-08-15 07:25:30 +00:00
osquery::Status logString(const std::string& s, const std::string& receiver);
2014-07-31 00:35:19 +00:00
/**
* @brief Directly log results of scheduled queries to the default receiver
2014-09-15 20:02:23 +00:00
*
* @param item a struct representing the results of a scheduled query
2014-09-15 20:02:23 +00:00
*
* @return an instance of osquery::Status, indicating the success or failure
* of the operation.
2014-09-15 20:02:23 +00:00
*/
osquery::Status logScheduledQueryLogItem(
2014-09-21 21:27:09 +00:00
const osquery::ScheduledQueryLogItem& item);
2014-09-15 20:02:23 +00:00
/**
* @brief Directly log results of scheduled queries to a specified receiver
2014-09-15 20:02:23 +00:00
*
* @param item a struct representing the results of a scheduled query
* @param receiver a string representing the log receiver to use
2014-09-15 20:02:23 +00:00
*
* @return an instance of osquery::Status, indicating the success or failure
* of the operation.
2014-09-15 20:02:23 +00:00
*/
osquery::Status logScheduledQueryLogItem(
2014-09-21 21:29:28 +00:00
const osquery::ScheduledQueryLogItem& item, const std::string& receiver);
2014-08-15 07:25:30 +00:00
}