Skip to content

Commit

Permalink
fixed logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Oct 27, 2023
1 parent adcb519 commit 6ef0a1a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/screens/LogScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,26 @@ export const Logs: React.FC<{ app: App; service?: string }> = ({
const { run: logcommand, logs, error, finished } = useLazyCommand({});

useEffect(() => {
logcommand({
program: "docker",
args: service
? ["compose", "logs", "-f", "--tail", "30", service]
: ["compose", "logs", "-f", "--tail", "30"],
options: {
cwd: app.path,
},
});
const timeout = setInterval(() => {
logcommand({
program: "docker",
args: service
? ["compose", "logs", "-f", "--tail", "50", service]
: ["compose", "logs", "-f", "--tail", "50"],
? ["compose", "logs", "-f", "--tail", "30", service]
: ["compose", "logs", "-f", "--tail", "30"],
options: {
cwd: app.path,
},
});
}, 1000);
}, 4000);
return () => clearInterval(timeout);
}, [retrigger]);

Expand All @@ -46,7 +55,7 @@ export const Logs: React.FC<{ app: App; service?: string }> = ({
>
<pre className="flex-grow bg-card rounded rounded-xl p-2">
{logs && logs.length > 0 ? (
logs.map((l, index) => (
logs.toReversed().map((l, index) => (
<div key={index}>
{l}
<br />
Expand Down

0 comments on commit 6ef0a1a

Please sign in to comment.