1 /* Copyright 2016-present Samsung Electronics Co., Ltd. and other contributors
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 var fs = require('fs');
18 function Logger(path) {
38 Logger.prototype.message = function (msg, status) {
40 // FIXME : After fs.appendFile is implemented, it should be replaced.
41 var data = fs.readFileSync(this.path);
42 var newData = data + msg + "\n";
43 fs.writeFileSync(this.path, new Buffer(newData));
45 if (status == this.status.pass) {
46 console.log(this.text_colors.green + msg + this.text_colors.empty);
47 } else if (status == this.status.skip) {
48 console.log(this.text_colors.yellow + msg + this.text_colors.empty);
49 } else if (status == this.status.fail || status == this.status.timeout){
50 console.log(this.text_colors.red + msg + this.text_colors.empty);
51 } else if (status == this.status.summary){
52 console.log(this.text_colors.blue + msg + this.text_colors.empty);
58 module.exports.Logger = Logger;