Skip to content

Commit

Permalink
* Added new log type COR , to filter messages from CORE.
Browse files Browse the repository at this point in the history
 * Fixed a bug in post_capture. It was missed under certain conditions.
  • Loading branch information
sackmotion committed Nov 27, 2011
1 parent 48b9b3f commit 2efcf1b
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 30 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Expand Up @@ -42,6 +42,7 @@ Features
* Improve detection of av_register_protocol() for ffmpeg (Angel Carpintero).
* Added support for libjpeg-turbo
http://www.lavrsen.dk/foswiki/bin/view/Motion/FeatureRequest2010x04x14x082244 (Angel Carpintero)
* Added new log type COR , to filter messages from CORE. (Angel Carpintero)

Bugfixes
* Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero)
Expand Down Expand Up @@ -69,6 +70,7 @@ Bugfixes
* Made micro-lightswitch optional (see lightwitch option in motion.conf)
* Fixed help text for options event_gap and area_detect
* Fixed motion.conf-dist , adding text according with config options.
* Fixed a bug in post_capture. It was missed under certain conditions.

3.2.12 Summary of Changes

Expand Down
2 changes: 1 addition & 1 deletion conf.c
Expand Up @@ -228,7 +228,7 @@ config_param config_params[] = {
},
{
"log_type",
"# Filter to log messages by type (STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL)",
"# Filter to log messages by type (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL)",
1,
CONF_OFFSET(log_type_str),
copy_string,
Expand Down
18 changes: 9 additions & 9 deletions configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for motion Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6.
# Generated by GNU Autoconf 2.67 for motion Git-48b9b3f938847204fc01553ecfffc7719af70b3d.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
Expand Down Expand Up @@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='motion'
PACKAGE_TARNAME='motion'
PACKAGE_VERSION='Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6'
PACKAGE_STRING='motion Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6'
PACKAGE_VERSION='Git-48b9b3f938847204fc01553ecfffc7719af70b3d'
PACKAGE_STRING='motion Git-48b9b3f938847204fc01553ecfffc7719af70b3d'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1217,7 +1217,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures motion Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6 to adapt to many kinds of systems.
\`configure' configures motion Git-48b9b3f938847204fc01553ecfffc7719af70b3d to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1278,7 +1278,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of motion Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6:";;
short | recursive ) echo "Configuration of motion Git-48b9b3f938847204fc01553ecfffc7719af70b3d:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1424,7 +1424,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
motion configure Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6
motion configure Git-48b9b3f938847204fc01553ecfffc7719af70b3d
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2021,7 +2021,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by motion $as_me Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6, which was
It was created by motion $as_me Git-48b9b3f938847204fc01553ecfffc7719af70b3d, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -6532,7 +6532,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by motion $as_me Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6, which was
This file was extended by motion $as_me Git-48b9b3f938847204fc01553ecfffc7719af70b3d, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -6594,7 +6594,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
motion config.status Git-944d1ee5adebe1c9cc99da64975e599ebee5aeb6
motion config.status Git-48b9b3f938847204fc01553ecfffc7719af70b3d
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion logger.c
Expand Up @@ -18,7 +18,7 @@ static FILE *logfile;
static unsigned int log_level = LEVEL_DEFAULT;
static unsigned int log_type = TYPE_DEFAULT;

static const char *log_type_str[] = {NULL, "STR", "ENC", "NET", "DBL", "EVT", "TRK", "VID", "ALL"};
static const char *log_type_str[] = {NULL, "COR", "STR", "ENC", "NET", "DBL", "EVT", "TRK", "VID", "ALL"};
static const char *log_level_str[] = {"EMG", "ALR", "CRT", "ERR", "WRN", "NTC", "INF", "DBG", "ALL", NULL};


Expand Down
3 changes: 2 additions & 1 deletion logger.h
Expand Up @@ -32,11 +32,12 @@
#define NTC LOG_NOTICE /* syslog 5 motion 6 */
#define INF LOG_INFO /* syslog 6 motion 7 */
#define DBG LOG_DEBUG /* syslog 7 motion 8 */
#define ALL LOG_ALL /* syslog 7 motion 9 */
#define ALL LOG_ALL /* syslog 8 motion 9 */
#define LEVEL_DEFAULT NTC /* syslog 5 motion 6 default */
#define SHOW_LEVEL_VALUE(x) (x+1)

/* Log types */
#define TYPE_CORE 0 /* Core logs */
#define TYPE_STREAM 1 /* Stream logs */
#define TYPE_ENCODER 2 /* Encoder logs */
#define TYPE_NETCAM 3 /* Netcam logs */
Expand Down
4 changes: 2 additions & 2 deletions motion-dist.conf.in
Expand Up @@ -24,10 +24,10 @@ setup_mode off
# Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined)
;logfile /tmp/motion.log

# Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, ERR, DBG, ALL). (default: 6 / NTC)
# Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC)
log_level 6

# Filter to log messages by type (STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL)
# Filter to log messages by type (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL)
log_type all

###########################################################
Expand Down
14 changes: 11 additions & 3 deletions motion.1
Expand Up @@ -24,10 +24,10 @@ Run in non-daemon mode.
Run in setup mode. Also forces non-daemon mode
.TP
.B \-d log level
Set log level [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, ERR, DBG, ALL). (default: 6 / NTC)
Set log level [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL). (default: 6 / NTC)
.TP
.B \-k log type
Set type of log (STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL)
Set type of log (COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL). (default: ALL)
.TP
.B \-p
Full path and filename for process id file (pid file). E.g /var/run/motion.pid. Default is not defined. Pid file is only created when Motion is started in daemon mode.
Expand All @@ -44,7 +44,13 @@ Boolean options can be on or off (values "1", "yes" and "on" all means true and
.B area_detect integer
Values: 0 - 999999999 / Default: Not defined
.br
Detect motion center in predefined areas. A script (on_area_detected) is started immediately when motion center is detected in one of the given areas, but only once during an event even if there is motion in a different configured area.
Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3
.br
A script (on_area_detected) is started immediately when motion is 4 5 6
.br
detected in one of the given areas, but only once during an event. 7 8 9
.br
One or more areas can be specified with this option. Take care: This option does NOT restrict detection to these areas! (Default: not defined)
.TP
.B auto_brightness boolean
Values: on, off / Default: off
Expand Down Expand Up @@ -274,6 +280,8 @@ URL to use for a netcam proxy server, if required. The syntax is http://myproxy:
Values: Max 4095 characters / Default: Not defined
.br
Specify an url to a downloadable jpeg file or raw mjpeg stream to use as input device. Such as an AXIS 2100 network camera.
.br
http:// ftp:// mjpg:// or file:/// ( mjpg:// is for network cameras with codec mjpeg ).
.TP
.B netcam_userpass string
Values: Max 4095 characters / Default: Not defined
Expand Down
26 changes: 13 additions & 13 deletions motion.c
Expand Up @@ -1796,18 +1796,15 @@ static void *motion_loop(void *arg)
}

if (frame_count >= cnt->conf.minimum_motion_frames) {

cnt->current_image->flags |= (IMAGE_TRIGGER | IMAGE_SAVE);
cnt->detecting_motion = 1;
#ifdef HAVE_FFMPEG
if (cnt->ffmpeg_output || (cnt->conf.useextpipe && cnt->extpipe)) {
#else
if (cnt->conf.useextpipe && cnt->extpipe) {
#endif
/* Setup the postcap counter */
cnt->postcap = cnt->conf.post_capture;
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "%s: Setup post capture %d",
cnt->postcap);
}

/* Setup the postcap counter */
cnt->postcap = cnt->conf.post_capture;
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "%s: Setup post capture %d",
cnt->postcap);

/* Mark all images in image_ring to be saved */
for (i = 0; i < cnt->imgs.image_ring_size; i++)
cnt->imgs.image_ring[i].flags |= IMAGE_SAVE;
Expand Down Expand Up @@ -1838,6 +1835,8 @@ static void *motion_loop(void *arg)
/* No motion, doing postcap */
cnt->current_image->flags |= (IMAGE_POSTCAP | IMAGE_SAVE);
cnt->postcap--;
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "%s: post capture %d",
cnt->postcap);
} else {
/* Done with postcap, so just have the image in the precap buffer */
cnt->current_image->flags |= IMAGE_PRECAP;
Expand Down Expand Up @@ -2462,7 +2461,7 @@ static void motion_startup(int daemonize, int argc, char *argv[])
cnt_list[0]->log_level = cnt_list[0]->conf.log_level - 1; // Let's make syslog compatible
}

set_log_level(cnt_list[0]->log_level);
//set_log_level(cnt_list[0]->log_level);

#ifdef HAVE_SDL
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Motion "VERSION" Started with SDL support");
Expand Down Expand Up @@ -2499,6 +2498,7 @@ static void motion_startup(int daemonize, int argc, char *argv[])
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Using log type (%s) log level (%s)",
get_log_type_str(cnt_list[0]->log_type), get_log_level_str(cnt_list[0]->log_level));

set_log_level(cnt_list[0]->log_level);
set_log_type(cnt_list[0]->log_type);

initialize_chars();
Expand Down Expand Up @@ -2764,7 +2764,7 @@ int main (int argc, char **argv)

if (((motion_threads_running == 0) && finish) ||
((motion_threads_running == 0) && (threads_running == 0))) {
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "%s: DEBUG-1 threads_running %d motion_threads_running %d "
MOTION_LOG(ALL, TYPE_ALL, NO_ERRNO, "%s: DEBUG-1 threads_running %d motion_threads_running %d "
", finish %d", threads_running, motion_threads_running, finish);
break;
}
Expand Down Expand Up @@ -2800,7 +2800,7 @@ int main (int argc, char **argv)
}
}

MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "%s: DEBUG-2 threads_running %d motion_threads_running %d finish %d",
MOTION_LOG(ALL, TYPE_ALL, NO_ERRNO, "%s: DEBUG-2 threads_running %d motion_threads_running %d finish %d",
threads_running, motion_threads_running, finish);
}
/* Reset end main loop flag */
Expand Down

0 comments on commit 2efcf1b

Please sign in to comment.