feat(ui): logging cleanup

- simplify access to app logger
- spruce up and make consistent log format
- improve messaging
This commit is contained in:
psychedelicious
2023-07-22 21:03:56 +10:00
parent 907ff165be
commit 75863e7181
65 changed files with 480 additions and 573 deletions

View File

@ -1,12 +1,11 @@
import { log } from 'app/logging/useLogger';
import { logger } from 'app/logging/logger';
import { zControlNetModel } from 'features/parameters/types/parameterSchemas';
import { ControlNetModelField } from 'services/api/types';
const moduleLog = log.child({ module: 'models' });
export const modelIdToControlNetModelParam = (
controlNetModelId: string
): ControlNetModelField | undefined => {
const log = logger('models');
const [base_model, model_type, model_name] = controlNetModelId.split('/');
const result = zControlNetModel.safeParse({
@ -15,7 +14,7 @@ export const modelIdToControlNetModelParam = (
});
if (!result.success) {
moduleLog.error(
log.error(
{
controlNetModelId,
errors: result.error.format(),

View File

@ -1,11 +1,11 @@
import { logger } from 'app/logging/logger';
import { LoRAModelParam, zLoRAModel } from '../types/parameterSchemas';
import { log } from 'app/logging/useLogger';
const moduleLog = log.child({ module: 'models' });
export const modelIdToLoRAModelParam = (
loraModelId: string
): LoRAModelParam | undefined => {
const log = logger('models');
const [base_model, model_type, model_name] = loraModelId.split('/');
const result = zLoRAModel.safeParse({
@ -14,7 +14,7 @@ export const modelIdToLoRAModelParam = (
});
if (!result.success) {
moduleLog.error(
log.error(
{
loraModelId,
errors: result.error.format(),

View File

@ -1,14 +1,13 @@
import { logger } from 'app/logging/logger';
import {
MainModelParam,
zMainModel,
} from 'features/parameters/types/parameterSchemas';
import { log } from 'app/logging/useLogger';
const moduleLog = log.child({ module: 'models' });
export const modelIdToMainModelParam = (
mainModelId: string
): MainModelParam | undefined => {
const log = logger('models');
const [base_model, model_type, model_name] = mainModelId.split('/');
const result = zMainModel.safeParse({
@ -17,7 +16,7 @@ export const modelIdToMainModelParam = (
});
if (!result.success) {
moduleLog.error(
log.error(
{
mainModelId,
errors: result.error.format(),

View File

@ -1,11 +1,10 @@
import { logger } from 'app/logging/logger';
import { VaeModelParam, zVaeModel } from '../types/parameterSchemas';
import { log } from 'app/logging/useLogger';
const moduleLog = log.child({ module: 'models' });
export const modelIdToVAEModelParam = (
vaeModelId: string
): VaeModelParam | undefined => {
const log = logger('models');
const [base_model, model_type, model_name] = vaeModelId.split('/');
const result = zVaeModel.safeParse({
@ -14,7 +13,7 @@ export const modelIdToVAEModelParam = (
});
if (!result.success) {
moduleLog.error(
log.error(
{
vaeModelId,
errors: result.error.format(),