src/logFormatting.js
function parseObject(obj, { name, path, subPaths, type, recursive = true, ...args }) {
    let property = get(obj, path);
    if (property === null || !validatePropertyType(property, type, recursive)) {
        return [];
    }
    if (type === 'uuidList' && isUuidList(property)) {
        return [{ [name]: property.split(',') }];
    }
    if (recursive && typeof property === 'object') {
        const propertyName = isNil(name) ? '' : name;
        const nextPaths = subPaths || Object.keys(property);
        return flatten(nextPaths
            .map(subPath => parseObject(obj, {
                name: `${propertyName}${subPath}`,
                path: `${path}.${subPath}`,
                recursive: false,
                type,
                ...args,
            })));
    }
    if (args.filterPattern) {
        property = typeof property === 'string' ? get(property.match(args.filterPattern), '[1]') : null;
    }
    if (args.hideUUID) {
        property = typeof property === 'string' ? property.replace(
            RegExp('[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}', 'g'),
            '{uuid}',
        ) : null;
    }
    return property === null ? [] : [{ [name]: property }];
}
function parseObject(obj, { name, path, subPaths, type, recursive = true, ...args }) {
    let property = get(obj, path);
    if (property === null || !validatePropertyType(property, type, recursive)) {
        return [];
    }
    if (type === 'uuidList' && isUuidList(property)) {
        return [{ [name]: property.split(',') }];
    }
    if (recursive && typeof property === 'object') {
        const propertyName = isNil(name) ? '' : name;
        const nextPaths = subPaths || Object.keys(property);
        return flatten(nextPaths
            .map(subPath => parseObject(obj, {
                name: `${propertyName}${subPath}`,
                path: `${path}.${subPath}`,
                recursive: false,
                type,
                ...args,
            })));
    }
    if (args.filterPattern) {
        property = typeof property === 'string' ? get(property.match(args.filterPattern), '[1]') : null;
    }
    if (args.hideUUID) {
        property = typeof property === 'string' ? property.replace(
            RegExp('[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}', 'g'),
            '{uuid}',
        ) : null;
    }
    return property === null ? [] : [{ [name]: property }];
}
function parseObject ( obj , { name , path , subPaths , type , recursive = true , ... args } ) { let property = get ( obj , path ) ; if ( property === null || ! validatePropertyType ( property , type , recursive ) ) { return [ ] ; } if ( type === 'uuidList' && isUuidList ( property ) ) { return [ { [ name ] : property . split ( ',' ) } ] ; } if ( recursive && typeof property === 'object' ) { const propertyName = isNil ( name ) ? '' : name ; const nextPaths = subPaths || Object . keys ( property ) ; return flatten ( nextPaths . map ( subPath => parseObject ( obj , { name : ` ${ propertyName } ${ subPath } ` , path : ` ${ path } ${ subPath } ` , recursive : false , type , ... args , } ) ) ) ; } if ( args . filterPattern ) { property = typeof property === 'string' ? get ( property . match ( args . filterPattern ) , '[1]' ) : null ; } if ( args . hideUUID ) { property = typeof property === 'string' ? property . replace ( RegExp ( '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}' , 'g' ) , '{uuid}' , ) : null ; } return property === null ? [ ] : [ { [ name ] : property } ] ; }
Helper function to extractLoggingProperties Parse rules and return an array of properties to log
Helper function to extractLoggingProperties Parse rules and return an array of properties to log