Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
3cd159bc
Commit
3cd159bc
authored
Oct 12, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetic
parent
902e6ae8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
27 deletions
+28
-27
modules/misc/logger.c
modules/misc/logger.c
+28
-27
No files found.
modules/misc/logger.c
View file @
3cd159bc
...
@@ -158,37 +158,38 @@ vlc_module_end();
...
@@ -158,37 +158,38 @@ vlc_module_end();
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
;
char
*
psz_mode
,
*
psz_file
,
*
psz_rrd_file
;
char
*
psz_mode
,
*
psz_file
,
*
psz_rrd_file
;
CONSOLE_INTRO_MSG
;
CONSOLE_INTRO_MSG
;
msg_Info
(
p_intf
,
"using logger..."
);
msg_Info
(
p_intf
,
"using logger..."
);
/* Allocate instance and initialize some members */
/* Allocate instance and initialize some members */
p_intf
->
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
)
);
p_
sys
=
p_
intf
->
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
p_
intf
->
p_
sys
==
NULL
)
if
(
p_sys
==
NULL
)
return
-
1
;
return
VLC_ENOMEM
;
psz_mode
=
var_CreateGetString
(
p_intf
,
"logmode"
);
psz_mode
=
var_CreateGetString
(
p_intf
,
"logmode"
);
if
(
psz_mode
)
if
(
psz_mode
)
{
{
if
(
!
strcmp
(
psz_mode
,
"text"
)
)
if
(
!
strcmp
(
psz_mode
,
"text"
)
)
{
{
p_
intf
->
p_
sys
->
i_mode
=
MODE_TEXT
;
p_sys
->
i_mode
=
MODE_TEXT
;
}
}
else
if
(
!
strcmp
(
psz_mode
,
"html"
)
)
else
if
(
!
strcmp
(
psz_mode
,
"html"
)
)
{
{
p_
intf
->
p_
sys
->
i_mode
=
MODE_HTML
;
p_sys
->
i_mode
=
MODE_HTML
;
}
}
#ifdef HAVE_SYSLOG_H
#ifdef HAVE_SYSLOG_H
else
if
(
!
strcmp
(
psz_mode
,
"syslog"
)
)
else
if
(
!
strcmp
(
psz_mode
,
"syslog"
)
)
{
{
p_
intf
->
p_
sys
->
i_mode
=
MODE_SYSLOG
;
p_sys
->
i_mode
=
MODE_SYSLOG
;
}
}
#endif
#endif
else
else
{
{
msg_Warn
(
p_intf
,
"invalid log mode `%s', using `text'"
,
psz_mode
);
msg_Warn
(
p_intf
,
"invalid log mode `%s', using `text'"
,
psz_mode
);
p_
intf
->
p_
sys
->
i_mode
=
MODE_TEXT
;
p_sys
->
i_mode
=
MODE_TEXT
;
}
}
free
(
psz_mode
);
free
(
psz_mode
);
...
@@ -199,18 +200,18 @@ static int Open( vlc_object_t *p_this )
...
@@ -199,18 +200,18 @@ static int Open( vlc_object_t *p_this )
p_intf
->
p_sys
->
i_mode
=
MODE_TEXT
;
p_intf
->
p_sys
->
i_mode
=
MODE_TEXT
;
}
}
if
(
p_
intf
->
p_
sys
->
i_mode
!=
MODE_SYSLOG
)
if
(
p_sys
->
i_mode
!=
MODE_SYSLOG
)
{
{
psz_file
=
config_GetPsz
(
p_intf
,
"logfile"
);
psz_file
=
config_GetPsz
(
p_intf
,
"logfile"
);
if
(
!
psz_file
)
if
(
!
psz_file
)
{
{
#ifdef __APPLE__
#ifdef __APPLE__
if
(
asprintf
(
&
psz_file
,
"%s/"
LOG_DIR
"/%s"
,
config_GetHomeDir
(),
if
(
asprintf
(
&
psz_file
,
"%s/"
LOG_DIR
"/%s"
,
config_GetHomeDir
(),
(
p_
intf
->
p_
sys
->
i_mode
==
MODE_HTML
)
?
LOG_FILE_HTML
(
p_sys
->
i_mode
==
MODE_HTML
)
?
LOG_FILE_HTML
:
LOG_FILE_TEXT
)
==
-
1
)
:
LOG_FILE_TEXT
)
==
-
1
)
psz_file
=
NULL
;
psz_file
=
NULL
;
#else
#else
switch
(
p_
intf
->
p_
sys
->
i_mode
)
switch
(
p_sys
->
i_mode
)
{
{
case
MODE_HTML
:
case
MODE_HTML
:
psz_file
=
strdup
(
LOG_FILE_HTML
);
psz_file
=
strdup
(
LOG_FILE_HTML
);
...
@@ -227,11 +228,11 @@ static int Open( vlc_object_t *p_this )
...
@@ -227,11 +228,11 @@ static int Open( vlc_object_t *p_this )
/* Open the log file and remove any buffering for the stream */
/* Open the log file and remove any buffering for the stream */
msg_Dbg
(
p_intf
,
"opening logfile `%s'"
,
psz_file
);
msg_Dbg
(
p_intf
,
"opening logfile `%s'"
,
psz_file
);
p_
intf
->
p_
sys
->
p_file
=
utf8_fopen
(
psz_file
,
"at"
);
p_sys
->
p_file
=
utf8_fopen
(
psz_file
,
"at"
);
if
(
p_
intf
->
p_
sys
->
p_file
==
NULL
)
if
(
p_sys
->
p_file
==
NULL
)
{
{
msg_Err
(
p_intf
,
"error opening logfile `%s'"
,
psz_file
);
msg_Err
(
p_intf
,
"error opening logfile `%s'"
,
psz_file
);
free
(
p_
intf
->
p_
sys
);
free
(
p_sys
);
free
(
psz_file
);
free
(
psz_file
);
return
-
1
;
return
-
1
;
}
}
...
@@ -242,18 +243,18 @@ static int Open( vlc_object_t *p_this )
...
@@ -242,18 +243,18 @@ static int Open( vlc_object_t *p_this )
switch
(
p_intf
->
p_sys
->
i_mode
)
switch
(
p_intf
->
p_sys
->
i_mode
)
{
{
case
MODE_HTML
:
case
MODE_HTML
:
LOG_STRING
(
HTML_HEADER
,
p_
intf
->
p_
sys
->
p_file
);
LOG_STRING
(
HTML_HEADER
,
p_sys
->
p_file
);
break
;
break
;
case
MODE_TEXT
:
case
MODE_TEXT
:
default:
default:
LOG_STRING
(
TEXT_HEADER
,
p_
intf
->
p_
sys
->
p_file
);
LOG_STRING
(
TEXT_HEADER
,
p_sys
->
p_file
);
break
;
break
;
}
}
}
}
else
else
{
{
p_
intf
->
p_
sys
->
p_file
=
NULL
;
p_sys
->
p_file
=
NULL
;
#ifdef HAVE_SYSLOG_H
#ifdef HAVE_SYSLOG_H
openlog
(
"vlc"
,
LOG_PID
|
LOG_NDELAY
,
LOG_DAEMON
);
openlog
(
"vlc"
,
LOG_PID
|
LOG_NDELAY
,
LOG_DAEMON
);
#endif
#endif
...
@@ -271,7 +272,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -271,7 +272,7 @@ static int Open( vlc_object_t *p_this )
}
}
free
(
psz_rrd_file
);
free
(
psz_rrd_file
);
p_
intf
->
p_
sys
->
p_sub
=
msg_Subscribe
(
p_intf
);
p_sys
->
p_sub
=
msg_Subscribe
(
p_intf
);
p_intf
->
pf_run
=
Run
;
p_intf
->
pf_run
=
Run
;
return
0
;
return
0
;
...
@@ -285,15 +286,15 @@ static void Close( vlc_object_t *p_this )
...
@@ -285,15 +286,15 @@ static void Close( vlc_object_t *p_this )
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
/* Flush the queue and unsubscribe from the message queue */
/* Flush the queue and unsubscribe from the message queue */
FlushQueue
(
p_
intf
->
p_sys
->
p_sub
,
p_intf
->
p_sys
->
p_file
,
FlushQueue
(
p_
sys
->
p_sub
,
p_sys
->
p_file
,
p_
intf
->
p_
sys
->
i_mode
,
p_sys
->
i_mode
,
var_CreateGetInteger
(
p_intf
,
"verbose"
)
);
var_CreateGetInteger
(
p_intf
,
"verbose"
)
);
msg_Unsubscribe
(
p_intf
,
p_
intf
->
p_
sys
->
p_sub
);
msg_Unsubscribe
(
p_intf
,
p_sys
->
p_sub
);
switch
(
p_
intf
->
p_
sys
->
i_mode
)
switch
(
p_sys
->
i_mode
)
{
{
case
MODE_HTML
:
case
MODE_HTML
:
LOG_STRING
(
HTML_FOOTER
,
p_
intf
->
p_
sys
->
p_file
);
LOG_STRING
(
HTML_FOOTER
,
p_sys
->
p_file
);
break
;
break
;
case
MODE_TEXT
:
case
MODE_TEXT
:
#ifdef HAVE_SYSLOG_H
#ifdef HAVE_SYSLOG_H
...
@@ -302,16 +303,16 @@ static void Close( vlc_object_t *p_this )
...
@@ -302,16 +303,16 @@ static void Close( vlc_object_t *p_this )
break
;
break
;
#endif
#endif
default:
default:
LOG_STRING
(
TEXT_FOOTER
,
p_
intf
->
p_
sys
->
p_file
);
LOG_STRING
(
TEXT_FOOTER
,
p_sys
->
p_file
);
break
;
break
;
}
}
/* Close the log file */
/* Close the log file */
if
(
p_
intf
->
p_
sys
->
i_mode
!=
MODE_SYSLOG
)
if
(
p_sys
->
i_mode
!=
MODE_SYSLOG
)
fclose
(
p_
intf
->
p_
sys
->
p_file
);
fclose
(
p_sys
->
p_file
);
/* Destroy structure */
/* Destroy structure */
free
(
p_
intf
->
p_
sys
);
free
(
p_sys
);
}
}
/*****************************************************************************
/*****************************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment