Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(logs): show addon logs when addonId is provided #681

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/commands/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@ const LogV2 = require('../models/log.js');
const Log = require('../models/log-v4.js');
const Logger = require('../logger.js');
const { Deferred } = require('../models/utils.js');
const colors = require('colors/safe');

async function appLogs (params) {
const { alias, after: since, before: until, search, 'deployment-id': deploymentId } = params.options;
const { alias, addon: addonId, after: since, before: until, search, 'deployment-id': deploymentId } = params.options;

// ignore --search ""
const filter = (search !== '') ? search : null;

const { appId, ownerId } = await AppConfig.getAppDetails({ alias });

Logger.println('Waiting for application logs…');

// TODO: drop when addons are migrated to the v4 API
if (params.addon) {
const { addon: addonId } = params.options;
if (addonId) {
Logger.println(colors.blue('Waiting for addon logs…'));
const appAddonId = addonId || await AppConfig.getAppDetails({ alias }).then(({ appId }) => appId);
miton18 marked this conversation as resolved.
Show resolved Hide resolved
return LogV2.displayLogs({ appAddonId, since, until, filter, deploymentId });
}

Logger.println(colors.blue('Waiting for application logs…'));

const deferred = new Deferred();
await Log.displayLogs({ ownerId, appId, since, until, filter, deploymentId, deferred });
return deferred.promise;
Expand Down
Loading