Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f46775a2
Kaydet (Commit)
f46775a2
authored
Nis 03, 2012
tarafından
Luboš Luňák
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SAL_DEBUG(), instead of those temporary debug printf's
üst
f4e0cbaa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
6 deletions
+29
-6
log.h
sal/inc/sal/detail/log.h
+1
-0
log.hxx
sal/inc/sal/log.hxx
+18
-3
log.cxx
sal/osl/all/log.cxx
+10
-3
No files found.
sal/inc/sal/detail/log.h
Dosyayı görüntüle @
f46775a2
...
@@ -72,6 +72,7 @@ extern "C" {
...
@@ -72,6 +72,7 @@ extern "C" {
enum
sal_detail_LogLevel
{
enum
sal_detail_LogLevel
{
SAL_DETAIL_LOG_LEVEL_INFO
,
SAL_DETAIL_LOG_LEVEL_WARN
,
SAL_DETAIL_LOG_LEVEL_INFO
,
SAL_DETAIL_LOG_LEVEL_WARN
,
SAL_DETAIL_LOG_LEVEL_DEBUG
,
SAL_DETAIL_MAKE_FIXED_SIZE
=
SAL_MAX_ENUM
SAL_DETAIL_MAKE_FIXED_SIZE
=
SAL_MAX_ENUM
};
};
...
...
sal/inc/sal/log.hxx
Dosyayı görüntüle @
f46775a2
...
@@ -187,8 +187,9 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
...
@@ -187,8 +187,9 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
SAL_INFO(char const * area, expr),
SAL_INFO(char const * area, expr),
SAL_INFO_IF(bool condition, char const * area, expr),
SAL_INFO_IF(bool condition, char const * area, expr),
SAL_WARN(char const * area, expr), and
SAL_WARN(char const * area, expr),
SAL_WARN_IF(bool condition, char const * area, expr) produce an info resp.
SAL_WARN_IF(bool condition, char const * area, expr), and
SAL_DEBUG(expr) produce an info resp.
warning log entry with a message produced by piping items into a C++
warning log entry with a message produced by piping items into a C++
std::ostringstream. The given expr must be so that the full expression
std::ostringstream. The given expr must be so that the full expression
"stream << expr" is valid, where stream is a variable of type
"stream << expr" is valid, where stream is a variable of type
...
@@ -208,7 +209,11 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
...
@@ -208,7 +209,11 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
For the _IF variants, log output is only generated if the given condition is
For the _IF variants, log output is only generated if the given condition is
true (in addition to the other conditions that have to be met).
true (in addition to the other conditions that have to be met).
For all these macros, the given area argument must be non-null and must
The SAL_DEBUG macro is for temporary debug statements that are used while
working on code. It is never meant to remain in the code. It will always
simply output the given expression in debug builds.
For all the other macros, the given area argument must be non-null and must
match the regular expression
match the regular expression
<area> ::= <segment>("."<segment>)*
<area> ::= <segment>("."<segment>)*
...
@@ -312,6 +317,16 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
...
@@ -312,6 +317,16 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
SAL_DETAIL_ENABLE_LOG_WARN && (condition), \
SAL_DETAIL_ENABLE_LOG_WARN && (condition), \
::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
/**
Produce temporary debugging output from stream. This macro is meant
to be used only while working on code and should never exist in production code.
See @ref sal_log "basic logging functionality" for details.
*/
#define SAL_DEBUG(stream) \
SAL_DETAIL_LOG_STREAM( \
SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, SAL_WHERE, stream)
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal/osl/all/log.cxx
Dosyayı görüntüle @
f46775a2
...
@@ -77,10 +77,14 @@ char const * toString(sal_detail_LogLevel level) {
...
@@ -77,10 +77,14 @@ char const * toString(sal_detail_LogLevel level) {
return
"info"
;
return
"info"
;
case
SAL_DETAIL_LOG_LEVEL_WARN
:
case
SAL_DETAIL_LOG_LEVEL_WARN
:
return
"warn"
;
return
"warn"
;
case
SAL_DETAIL_LOG_LEVEL_DEBUG
:
return
"debug"
;
}
}
}
}
bool
report
(
sal_detail_LogLevel
level
,
char
const
*
area
)
{
bool
report
(
sal_detail_LogLevel
level
,
char
const
*
area
)
{
if
(
level
==
SAL_DETAIL_LOG_LEVEL_DEBUG
)
return
true
;
assert
(
area
!=
0
);
assert
(
area
!=
0
);
char
const
*
env
=
std
::
getenv
(
"SAL_LOG"
);
char
const
*
env
=
std
::
getenv
(
"SAL_LOG"
);
if
(
env
==
0
)
{
if
(
env
==
0
)
{
...
@@ -152,9 +156,12 @@ void log(
...
@@ -152,9 +156,12 @@ void log(
char
const
*
message
)
char
const
*
message
)
{
{
std
::
ostringstream
s
;
std
::
ostringstream
s
;
s
<<
toString
(
level
)
<<
':'
<<
area
<<
':'
<<
OSL_DETAIL_GETPID
<<
':'
if
(
level
==
SAL_DETAIL_LOG_LEVEL_DEBUG
)
<<
osl
::
Thread
::
getCurrentIdentifier
()
<<
':'
<<
where
<<
message
s
<<
toString
(
level
)
<<
':'
<<
/*no where*/
' '
<<
message
<<
'\n'
;
<<
'\n'
;
else
s
<<
toString
(
level
)
<<
':'
<<
area
<<
':'
<<
OSL_DETAIL_GETPID
<<
':'
<<
osl
::
Thread
::
getCurrentIdentifier
()
<<
':'
<<
where
<<
message
<<
'\n'
;
std
::
fputs
(
s
.
str
().
c_str
(),
stderr
);
std
::
fputs
(
s
.
str
().
c_str
(),
stderr
);
}
}
...
...
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