Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
8959f350
Commit
8959f350
authored
May 08, 2022
by
Pavel Vainerman
Committed by
Pavel Vainerman
May 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(logserver): supported "--set-verbosity" command, make style
parent
a191994e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
1 deletion
+31
-1
log.cc
Utilities/ULog/log.cc
+18
-1
LogServerTypes.h
include/LogServerTypes.h
+1
-0
LogReader.cc
src/Log/LogReader.cc
+0
-0
LogServer.cc
src/Log/LogServer.cc
+0
-0
LogServerTypes.cc
src/Log/LogServerTypes.cc
+8
-0
LogSession.cc
src/Log/LogSession.cc
+4
-0
No files found.
Utilities/ULog/log.cc
View file @
8959f350
...
@@ -38,6 +38,7 @@ static struct option longopts[] =
...
@@ -38,6 +38,7 @@ static struct option longopts[] =
{
"logfile-truncate"
,
required_argument
,
0
,
'z'
},
{
"logfile-truncate"
,
required_argument
,
0
,
'z'
},
{
"grep"
,
required_argument
,
0
,
'g'
},
{
"grep"
,
required_argument
,
0
,
'g'
},
{
"timezone"
,
required_argument
,
0
,
'm'
},
{
"timezone"
,
required_argument
,
0
,
'm'
},
{
"set-verbosity"
,
required_argument
,
0
,
'q'
},
{
NULL
,
0
,
0
,
0
}
{
NULL
,
0
,
0
,
0
}
};
};
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
...
@@ -63,6 +64,7 @@ static void print_help()
...
@@ -63,6 +64,7 @@ static void print_help()
printf
(
"[-a | --add] info,warn,crit,... [objName] - Add log levels.
\n
"
);
printf
(
"[-a | --add] info,warn,crit,... [objName] - Add log levels.
\n
"
);
printf
(
"[-d | --del] info,warn,crit,... [objName] - Delete log levels.
\n
"
);
printf
(
"[-d | --del] info,warn,crit,... [objName] - Delete log levels.
\n
"
);
printf
(
"[-s | --set] info,warn,crit,... [objName] - Set log levels.
\n
"
);
printf
(
"[-s | --set] info,warn,crit,... [objName] - Set log levels.
\n
"
);
printf
(
"[-q | --set-verbosity] level [objName] - Set verbose level.
\n
"
);
printf
(
"[-f | --filter] logname - ('filter mode'). View log only from 'logname'(regexp)
\n
"
);
printf
(
"[-f | --filter] logname - ('filter mode'). View log only from 'logname'(regexp)
\n
"
);
printf
(
"[-g | --grep pattern - Print lines matching a pattern (c++ regexp)
\n
"
);
printf
(
"[-g | --grep pattern - Print lines matching a pattern (c++ regexp)
\n
"
);
...
@@ -123,7 +125,7 @@ int main( int argc, char** argv )
...
@@ -123,7 +125,7 @@ int main( int argc, char** argv )
{
{
while
(
1
)
while
(
1
)
{
{
opt
=
getopt_long
(
argc
,
argv
,
"chvlf:a:p:i:d:s:n:eorbx:w:zt:g:uby:m:"
,
longopts
,
&
optindex
);
opt
=
getopt_long
(
argc
,
argv
,
"chvlf:a:p:i:d:s:n:eorbx:w:zt:g:uby:m:
q:
"
,
longopts
,
&
optindex
);
if
(
opt
==
-
1
)
if
(
opt
==
-
1
)
break
;
break
;
...
@@ -176,6 +178,20 @@ int main( int argc, char** argv )
...
@@ -176,6 +178,20 @@ int main( int argc, char** argv )
}
}
break
;
break
;
case
'q'
:
{
LogServerTypes
::
Command
cmd
=
LogServerTypes
::
cmdSetVerbosity
;
std
::
string
filter
(
""
);
int
d
=
uni_atoi
(
optarg
);
char
*
arg2
=
checkArg
(
optind
,
argc
,
argv
);
if
(
arg2
)
filter
=
string
(
arg2
);
vcmd
.
emplace_back
(
cmd
,
d
,
filter
);
}
break
;
case
'l'
:
case
'l'
:
{
{
cmdonly
=
1
;
cmdonly
=
1
;
...
@@ -285,6 +301,7 @@ int main( int argc, char** argv )
...
@@ -285,6 +301,7 @@ int main( int argc, char** argv )
{
{
LogServerTypes
::
Command
cmd
;
LogServerTypes
::
Command
cmd
;
std
::
string
tz
(
optarg
);
std
::
string
tz
(
optarg
);
if
(
tz
==
"local"
)
if
(
tz
==
"local"
)
cmd
=
LogServerTypes
::
cmdShowLocalTime
;
cmd
=
LogServerTypes
::
cmdShowLocalTime
;
else
if
(
tz
==
"utc"
)
else
if
(
tz
==
"utc"
)
...
...
include/LogServerTypes.h
View file @
8959f350
...
@@ -36,6 +36,7 @@ namespace uniset
...
@@ -36,6 +36,7 @@ namespace uniset
cmdRotate
,
/*!< пересоздать файл с логами */
cmdRotate
,
/*!< пересоздать файл с логами */
cmdOffLogFile
,
/*!< отключить запись файла логов (если включена) */
cmdOffLogFile
,
/*!< отключить запись файла логов (если включена) */
cmdOnLogFile
,
/*!< включить запись файла логов (если была отключена) */
cmdOnLogFile
,
/*!< включить запись файла логов (если была отключена) */
cmdSetVerbosity
,
/*!< установить уровень verbose */
// работа с логами по умолчанию
// работа с логами по умолчанию
cmdSaveLogLevel
,
/*!< запомнить текущее состояние логов (для восстановления при завершении сессии или команде Restore) */
cmdSaveLogLevel
,
/*!< запомнить текущее состояние логов (для восстановления при завершении сессии или команде Restore) */
...
...
src/Log/LogReader.cc
View file @
8959f350
src/Log/LogServer.cc
View file @
8959f350
src/Log/LogServerTypes.cc
View file @
8959f350
...
@@ -97,6 +97,9 @@ namespace uniset
...
@@ -97,6 +97,9 @@ namespace uniset
case
LogServerTypes
:
:
cmdDelLevel
:
case
LogServerTypes
:
:
cmdDelLevel
:
return
os
<<
"cmdDelLevel"
;
return
os
<<
"cmdDelLevel"
;
case
LogServerTypes
:
:
cmdSetVerbosity
:
return
os
<<
"cmdSetVerbosity"
;
case
LogServerTypes
:
:
cmdRotate
:
case
LogServerTypes
:
:
cmdRotate
:
return
os
<<
"cmdRotate"
;
return
os
<<
"cmdRotate"
;
...
@@ -192,6 +195,11 @@ namespace uniset
...
@@ -192,6 +195,11 @@ namespace uniset
LogServerTypes
::
Command
cmd
=
LogServerTypes
::
cmdDelLevel
;
LogServerTypes
::
Command
cmd
=
LogServerTypes
::
cmdDelLevel
;
vcmd
.
emplace_back
(
cmd
,
(
uint32_t
)
Debug
::
value
(
arg1
),
filter
);
vcmd
.
emplace_back
(
cmd
,
(
uint32_t
)
Debug
::
value
(
arg1
),
filter
);
}
}
else
if
(
c
==
"-q"
||
c
==
"--set-verbosity"
)
{
LogServerTypes
::
Command
cmd
=
LogServerTypes
::
cmdSetVerbosity
;
vcmd
.
emplace_back
(
cmd
,
(
uint32_t
)
Debug
::
value
(
arg1
),
filter
);
}
}
}
return
vcmd
;
return
vcmd
;
...
...
src/Log/LogSession.cc
View file @
8959f350
...
@@ -522,6 +522,10 @@ namespace uniset
...
@@ -522,6 +522,10 @@ namespace uniset
l
.
log
->
delLevel
(
(
Debug
::
type
)
msg
.
data
);
l
.
log
->
delLevel
(
(
Debug
::
type
)
msg
.
data
);
break
;
break
;
case
LogServerTypes
:
:
cmdSetVerbosity
:
l
.
log
->
verbose
(
(
Debug
::
verbosity
)
msg
.
data
);
break
;
case
LogServerTypes
:
:
cmdRotate
:
case
LogServerTypes
:
:
cmdRotate
:
l
.
log
->
onLogFile
(
true
);
l
.
log
->
onLogFile
(
true
);
break
;
break
;
...
...
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