<commit_before>/*
 Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
 */


var  rest = require(process.mainModule.exports["corePath"] + '/src/serverroot/common/rest.json.api');

var smConfig = require('../../common/api/sm.config'),
    smConstants = require('../../common/api/sm.constants'),
    assert = require('assert');
    sm = module.exports;

var smServerIP = smConfig.sm.server_ip,
    smServerPort = smConfig.sm.server_port;

var smREST = rest.getAPIServer({
    apiName: smConstants.SM_API_SERVER,
    server: smServerIP,
    port: smServerPort
});

function get(url, callback) {
    smREST.api.get(url, function (err, data) {
        callback(err, data);
    });
}

function put(url, putData, appData, callback) {
    smREST.api.put(url, putData, function (err, data) {
        callback(err, data);
    });
}

function post(url, postData, appData, callback) {
    smREST.api.post(url, postData, function (err, data) {
        callback(err, data);
    });
}

function del(url, appData, callback) {
    smREST.api.delete(url, function (err, data) {
        callback(err, data);
    });
}
<commit_msg>Closes-Bug: #1560691 Added transaction logs for get/put/post/delete operations for the webServer logs.<commit_after>/*
 Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
 */


var rest = require(process.mainModule.exports["corePath"] + '/src/serverroot/common/rest.json.api'),
    logutils = require(process.mainModule.exports["corePath"] + '/src/serverroot/utils/log.utils');

var smConfig = require('../../common/api/sm.config'),
    smConstants = require('../../common/api/sm.constants'),
    assert = require('assert');
    sm = module.exports;

var smServerIP = smConfig.sm.server_ip,
    smServerPort = smConfig.sm.server_port;

var smREST = rest.getAPIServer({
    apiName: smConstants.SM_API_SERVER,
    server: smServerIP,
    port: smServerPort
});

function get(url, callback) {
    logutils.logger.debug('TRANSACTION - ACTION - GET - ' + url);
    smREST.api.get(url, function (err, data) {
        logutils.logger.info('TRANSACTION - ACTION - GET - RESPONSE: ' + JSON.stringify(data));
        callback(err, data);
    });
}

function put(url, putData, appData, callback) {
    logutils.logger.debug('TRANSACTION - ACTION - PUT - ' + url + ' PUT DATA: ' + JSON.stringify(putData));
    smREST.api.put(url, putData, function (err, data) {
        logutils.logger.debug('TRANSACTION - ACTION - PUT - RESPONSE: ' + JSON.stringify(data));
        callback(err, data);
    });
}

function post(url, postData, appData, callback) {
    logutils.logger.debug('TRANSACTION - ACTION - POST - ' + url + ' POST DATA: ' + JSON.stringify(postData));
    smREST.api.post(url, postData, function (err, data) {
        logutils.logger.debug('TRANSACTION - ACTION - POST - RESPONSE: ' + JSON.stringify(data));
        callback(err, data);s
    });
}

function del(url, appData, callback) {
    logutils.logger.debug('TRANSACTION - ACTION - DELETE - ' + url);
    smREST.api.delete(url, function (err, data) {
        logutils.logger.debug('TRANSACTION - ACTION - DELETE - RESPONSE: ' + JSON.stringify(data));
        callback(err, data);
    });
}

{'fraction_non_alphanumeric': 0.15764631843927, 'fraction_numerical': 0.004719949653870359, 'mean_word_length': 3.366758241758242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1172923', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1032, 'n_words': 216}