File size: 644 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import wpcom from 'calypso/lib/wp';
/**
* Parameters sent to logstash endpoint.
* @see PCYsg-5T4-p2
*/
interface LogToLogstashParams {
/**
* Feature name.
*
* Should be explicitly allowed. @see D31385-code
*/
feature: 'calypso_ssr' | 'calypso_client';
message: string;
extra?: any;
site_id?: number;
tags?: string[];
[ key: string ]: any;
}
/**
* Log to logstash. This function is inefficient because
* the data goes over the REST API, so use sparingly.
*/
export async function logToLogstash( params: LogToLogstashParams ): Promise< void > {
await wpcom.req.post( '/logstash', { params: JSON.stringify( params ) } );
}
|