Function convertMotionMasterMessageToLoggerContext

  • Converts a IMotionMasterMessage into a structured context object suitable for logging.

    The resulting object includes:

    • namespace: a string identifying the logging context (default: 'reqResMessage'),
    • motionMasterMessage: the original message,
    • type: either 'request' or 'status' depending on the message content,
    • name: a comma-separated string of the keys in the request or status object.

    Returns

    An object containing the logging context with type, name, namespace, and original message.

    Example

    const context = convertMotionMasterMessageToLoggerContext(message, 'motion');
    console.log(context.namespace); // → 'motion'
    console.log(context.type); // → 'request' or 'status'
    console.log(context.name); // → comma-separated keys of the message content

    Remarks

    • Determines type by checking the presence of request or status in the message.
    • Useful for structured logging or telemetry where message metadata is required.

    Parameters

    • motionMasterMessage: IMotionMasterMessage

      The Motion Master message to convert.

    • namespace: string = 'reqResMessage'

      Optional namespace for the logging context (default is 'reqResMessage').

    Returns {
        motionMasterMessage: IMotionMasterMessage;
        name: string;
        namespace: string;
        type: string;
    }

Generated using TypeDoc