Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
c5e9ca5a
Commit
c5e9ca5a
authored
May 14, 2022
by
Dominik Hebeler
Browse files
fixed log creation
parent
a015ac4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
metager/app/Console/Commands/AppendLogs.php
View file @
c5e9ca5a
...
...
@@ -54,17 +54,19 @@ class AppendLogs extends Command
}
$elements
=
[];
$elementCount
=
$redis
->
llen
(
\
App\Console\Commands\AppendLogs
::
LOGKEY
);
$elements
=
$redis
->
lpop
(
\
App\Console\Commands\AppendLogs
::
LOGKEY
,
$elementCount
);
if
(
!
is_array
(
$elements
)
||
sizeof
(
$elements
)
<=
0
)
{
return
;
while
((
$value
=
$redis
->
lpop
(
\
App\Console\Commands\AppendLogs
::
LOGKEY
))
!==
false
){
$elements
[]
=
$value
;
}
if
(
file_put_contents
(
\
App\MetaGer
::
getMGLogFile
(),
implode
(
PHP_EOL
,
$elements
)
.
PHP_EOL
,
FILE_APPEND
)
===
false
)
{
$this
->
error
(
"Konnte Log Zeile(n) nicht schreiben"
);
$redis
->
lpush
(
\
App\Console\Commands\AppendLogs
::
LOGKEY
,
array_reverse
(
$elements
));
}
else
{
$this
->
info
(
"Added "
.
sizeof
(
$elements
)
.
" lines to todays log!"
);
$this
->
error
(
"Konnte "
.
sizeof
(
$elements
)
.
" Log Zeile(n) nicht schreiben"
);
foreach
(
$elements
as
$element
){
$redis
->
lPush
(
\
App\Console\Commands\AppendLogs
::
LOGKEY
,
$element
);
}
}
else
{
$this
->
info
(
"Added "
.
sizeof
(
$elements
)
.
" lines to todays log! "
.
\
App\MetaGer
::
getMGLogFile
());
}
}
}
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