EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
log.js
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2015 Sylvain Peyrefitte
3 *
4 * This file is part of node-rdpjs.
5 *
6 * node-rdpjs is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20var Levels = {
21 'DEBUG': 1,
22 'INFO': 2,
23 'WARN': 3,
24 'ERROR': 4,
25 'NONE': 5
26}
27
28/*
29var Logger = require('bunyan');
30
31let logStreams = [];
32
33if (process.env.enable_log_file === 'true') {
34 logStreams.push(
35 {
36 type: 'rotating-file',
37 period: '1d',
38 count: 2,
39 path: `node-rdpjs${process.pid}.log`,
40 level: process.env.log_level
41 }
42 );
43}
44
45logStreams.push(
46 {
47 stream: process.stderr,
48 level: process.env.log_level
49 }
50);
51
52var logger = Logger.createLogger({
53 name: 'node-rdpjs',
54 streams: logStreams
55});
56*/
57
58function log(level, message) {
59 if (Levels[level] < module.exports.level) return;
60 console.log("[node-rdpjs] " + level + ":\t" + message);
61}
62
63/**
64 * Module exports
65 */
66module.exports = {
67 level: Levels.INFO, // Levels.INFO,
68 Levels: Levels,
69 debug: function (message) {
70 //console.log(message);
71 //logger.debug(message);
72 },
73 info: function (message) {
74 //console.log(message);
75 //logger.info(message);
76 },
77 warn: function (message) {
78 //console.log(message);
79 //logger.warn(message);
80 },
81 error: function (message) {
82 //console.log(message);
83 //logger.error(message);
84 }
85};