clean: cleanup log outputs

This commit is contained in:
KernelDeimos
2024-12-10 14:19:01 -05:00
parent 1b578019f9
commit 8557c54527
6 changed files with 4 additions and 24 deletions
@@ -606,10 +606,6 @@ class AIChatService extends BaseService {
let model = parameters.model;
if ( ! model ) {
const service = this.services.get(intended_service);
console.log({
what: intended_service,
w: service.get_default_model
});
if ( ! service.get_default_model ) {
throw new Error('could not infer model from service');
}
@@ -68,6 +68,8 @@ class WebServerService extends BaseService {
router_webhooks: this.router_webhooks,
});
await services.emit('install.routes-gui', { app });
this.log.noticeme('web server setup done');
}
@@ -587,8 +589,6 @@ class WebServerService extends BaseService {
app.options('/*', (_, res) => {
return res.sendStatus(200);
});
console.log('WEB SERVER INIT DONE');
}
_register_commands (commands) {
+1 -1
View File
@@ -210,7 +210,7 @@ class Container {
*/
async emit (id, ...args) {
if ( this.logger ) {
this.logger.noticeme(`services:event ${id}`, { args });
this.logger.info(`services:event ${id}`, { args });
}
const promises = [];
@@ -19,6 +19,7 @@
*/
const APIError = require("../api/APIError");
const auth2 = require("../middleware/auth2");
const { Context } = require("../util/context");
const { Endpoint } = require("../util/expressutil");
const { TeePromise } = require('@heyputer/putility').libs.promise;
const BaseService = require("./BaseService");
@@ -172,7 +172,6 @@ class DriverService extends BaseService {
* It returns a promise that resolves to an object containing the result, metadata, and an error if one occurred.
*/
async _call ({ driver, iface, method, args }) {
console.log('??', driver, iface, method, args);
const processed_args = await this._process_args(iface, method, args);
const test_mode = Context.get('test_mode');
if ( test_mode ) {
@@ -230,7 +229,6 @@ class DriverService extends BaseService {
* @returns {DriverService} The driver service instance for the provided interface.
*/
const driver_service_exists = (() => {
console.log('CHECKING FOR THIS', driver, iface);
return this.services.has(driver) &&
this.services.get(driver).list_traits()
.includes(iface);
@@ -320,17 +318,12 @@ class DriverService extends BaseService {
actor,
PermissionUtil.join('service', service_name, 'ii', iface),
);
console.log({
perm: PermissionUtil.join('service', service_name, 'ii', iface),
reading,
});
const options = PermissionUtil.reading_to_options(reading);
if ( options.length <= 0 ) {
throw APIError.create('forbidden');
}
const option = await this.select_best_option_(options);
const policies = await this.get_policies_for_option_(option);
console.log('SLA', JSON.stringify(policies, undefined, ' '));
// NOT FINAL: For now we apply monthly usage logic
// to the first holder of the permission. Later this
@@ -437,14 +430,12 @@ class DriverService extends BaseService {
on_return: async result => {
if ( skip_usage ) return result;
console.log('monthly usage is returning');
const svc_monthlyUsage = services.get('monthly-usage');
const extra = {
'driver.interface': iface,
'driver.implementation': service_name,
'driver.method': method,
};
console.log('calling the increment method')
await svc_monthlyUsage.increment(actor, method_key, extra);
return result;
},
@@ -473,9 +464,7 @@ class DriverService extends BaseService {
const svc_registry = this.services.get('registry');
const c_interfaces = svc_registry.get('interfaces');
console.log('????--1', iface);
const interface_ = c_interfaces.get(iface);
console.log('????--2', interface_);
const method_spec = interface_.methods[method];
let desired_type =
method_spec.result_choices
@@ -84,18 +84,12 @@ class DriverUsagePolicyService extends BaseService {
actor,
PermissionUtil.join('service', service_name, 'ii', trait_name),
);
console.log({
perm: PermissionUtil.join('service', service_name, 'ii', trait_name),
reading: require('util').inspect(reading, { depth: null }),
});
const options = PermissionUtil.reading_to_options(reading);
console.log('OPTIONS', JSON.stringify(options, undefined, ' '));
if ( options.length <= 0 ) {
return undefined;
}
const option = await this.select_best_option_(options);
const policies = await this.get_policies_for_option_(option);
console.log('SLA', JSON.stringify(policies, undefined, ' '));
// NOT FINAL: For now we apply monthly usage logic
// to the first holder of the permission. Later this