Files
Marcelo Aquino 2175c993ef Linux: Use config file for gateway settings (#1061)
- The following settings can be use on the config file:
  - verbose=[debug,info,notice,warn,err] - Logging verbosity.
  - log_file[0|1] - Enable logging to a file.
  - log_filepath=(FILE) - Log file path.
  - log_pipe=[0|1] - Enable logging to a named pipe(aka fifo).
    Use this option to view your gateway's log messages from the
    log_pipe_file (defined below).
    To do so, run the following command on another terminal:
    - $ cat "log_pipe_file"
  - log_pipe_file=(FILE)
  - syslog=[0|1] - Enable logging to syslog.
  - eeprom_file=[/etc/mysensors.eeprom]
  - eeprom_size=[1024]
- Change some mysgw parameters:
  - Added:
    - -q, --quiet:  for quiet mode, disable log messages written to the
    terminal.
  - Removed:
    - -d, --debug: removed, log messages are now enabled by default.
  - Replaced:
    - -b, --background: replaced by --daemon
- isatty() is no longer used, log messages by default are printed to
  stderr unless the gateway is started with --quiet (#1022)
- MY_LINUX_CONFIG_FILE: no longer holds the path to the eeprom file,
  but to the configuration file
2018-03-23 11:00:34 +01:00

60 lines
2.1 KiB
C

/*
* The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2018 Sensnology AB
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
*
* Documentation: http://www.mysensors.org
* Support Forum: http://forum.mysensors.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
#ifndef LOG_H
#define LOG_H
#include <stdarg.h>
#include <stdio.h>
#include <syslog.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define vlogError(...) vlog(LOG_ERR, __VA_ARGS__)
#define vlogWarning(...) vlog(LOG_WARNING, __VA_ARGS__)
#define vlogNotice(...) vlog(LOG_NOTICE, __VA_ARGS__)
#define vlogInfo(...) vlog(LOG_INFO, __VA_ARGS__)
#define vlogDebug(...) vlog(LOG_DEBUG, __VA_ARGS__)
void logSetQuiet(uint8_t enable);
void logSetLevel(int level);
void logSetSyslog(int options, int facility);
int logSetPipe(char *pipe_file);
int logSetFile(char *file);
void logClose(void);
void vlog(int level, const char *fmt, va_list args);
void logEmergency(const char *fmt, ...) __attribute__((format(printf,1,2)));
void logAlert(const char *fmt, ...) __attribute__((format(printf,1,2)));
void logCritical(const char *fmt, ...) __attribute__((format(printf,1,2)));
void logError(const char *fmt, ...) __attribute__((format(printf,1,2)));
void logWarning(const char *fmt, ...) __attribute__((format(printf,1,2)));
void logNotice(const char *fmt, ...) __attribute__((format(printf,1,2)));
void logInfo(const char *fmt, ...) __attribute__((format(printf,1,2)));
void logDebug(const char *fmt, ...) __attribute__((format(printf,1,2)));
#ifdef __cplusplus
}
#endif
#endif