You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.3 KiB
87 lines
2.3 KiB
/*
|
|
** Zabbix
|
|
** Copyright (C) 2001-2023 Zabbix SIA
|
|
**
|
|
** This program is free software; you can redistribute it and/or modify
|
|
** it under the terms of the GNU General Public License as published by
|
|
** the Free Software Foundation; either version 2 of the License, or
|
|
** (at your option) any later version.
|
|
**
|
|
** This program is distributed in the hope that it will be useful,
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
** GNU General Public License for more details.
|
|
**
|
|
** You should have received a copy of the GNU General Public License
|
|
** along with this program; if not, write to the Free Software
|
|
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
**/
|
|
|
|
#ifndef ZABBIX_ZBXLOG_H
|
|
#define ZABBIX_ZBXLOG_H
|
|
|
|
#include "zbxcommon.h"
|
|
|
|
#define ZBX_LOG_TYPE_UNDEFINED 0
|
|
#define ZBX_LOG_TYPE_SYSTEM 1
|
|
#define ZBX_LOG_TYPE_FILE 2
|
|
#define ZBX_LOG_TYPE_CONSOLE 3
|
|
|
|
#define ZBX_OPTION_LOGTYPE_SYSTEM "system"
|
|
#define ZBX_OPTION_LOGTYPE_FILE "file"
|
|
#define ZBX_OPTION_LOGTYPE_CONSOLE "console"
|
|
|
|
#define ZBX_LOG_ENTRY_INTERVAL_DELAY 60 /* seconds */
|
|
|
|
void __zbx_update_env(double time_now);
|
|
|
|
#ifdef _WINDOWS
|
|
#define zbx_update_env(info, time_now) \
|
|
\
|
|
do \
|
|
{ \
|
|
__zbx_update_env(time_now); \
|
|
ZBX_UNUSED(info); \
|
|
} \
|
|
while (0)
|
|
#else
|
|
#define zbx_update_env(info, time_now) \
|
|
\
|
|
do \
|
|
{ \
|
|
__zbx_update_env(time_now); \
|
|
zbx_prof_update(info, time_now); \
|
|
} \
|
|
while (0)
|
|
#endif
|
|
|
|
typedef struct
|
|
{
|
|
char *log_file_name;
|
|
char *log_type_str;
|
|
int log_type;
|
|
int log_file_size;
|
|
} zbx_config_log_t;
|
|
|
|
int zbx_open_log(const zbx_config_log_t *log_file_cfg, int level, char **error);
|
|
void zbx_log_impl(int level, const char *fmt, va_list args);
|
|
void zbx_close_log(void);
|
|
|
|
char *zbx_strerror_from_system(zbx_syserror_t error);
|
|
|
|
#ifdef _WINDOWS
|
|
char *zbx_strerror_from_module(zbx_syserror_t error, const wchar_t *module);
|
|
#endif
|
|
|
|
int zbx_redirect_stdio(const char *filename);
|
|
|
|
void zbx_handle_log(void);
|
|
|
|
int zbx_get_log_type(const char *logtype);
|
|
int zbx_validate_log_parameters(ZBX_TASK_EX *task, const zbx_config_log_t *log_file_cfg);
|
|
|
|
void zbx_strlog_alloc(int level, char **out, size_t *out_alloc, size_t *out_offset, const char *format,
|
|
...) __zbx_attr_format_printf(5, 6);
|
|
|
|
#endif
|