Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion JavaScript/9-logger/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DATETIME_LENGTH = 19;

class Logger {
constructor(logPath) {
this.path = logPath;
this.path = process.cwd();
const date = new Date().toISOString().substring(0, 10);
const filePath = path.join(logPath, `${date}.log`);
this.stream = fs.createWriteStream(filePath, { flags: 'a' });
Expand Down
2 changes: 1 addition & 1 deletion JavaScript/a-config/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DATETIME_LENGTH = 19;

class Logger {
constructor(logPath) {
this.path = logPath;
this.path = process.cwd();
const date = new Date().toISOString().substring(0, 10);
const filePath = path.join(logPath, `${date}.log`);
this.stream = fs.createWriteStream(filePath, { flags: 'a' });
Expand Down
2 changes: 1 addition & 1 deletion JavaScript/b-transport/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DATETIME_LENGTH = 19;

class Logger {
constructor(logPath) {
this.path = logPath;
this.path = process.cwd();
const date = new Date().toISOString().substring(0, 10);
const filePath = path.join(logPath, `${date}.log`);
this.stream = fs.createWriteStream(filePath, { flags: 'a' });
Expand Down
2 changes: 1 addition & 1 deletion JavaScript/c-commonjs/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DATETIME_LENGTH = 19;

class Logger {
constructor(logPath) {
this.path = logPath;
this.path = process.cwd();
const date = new Date().toISOString().substring(0, 10);
const filePath = path.join(logPath, `${date}.log`);
this.stream = fs.createWriteStream(filePath, { flags: 'a' });
Expand Down
6 changes: 3 additions & 3 deletions JavaScript/d-messenger/lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const COLORS = {
const DATETIME_LENGTH = 19;

class Logger {
constructor(logPath) {
this.path = logPath;
constructor(logPath, appRootPath) {
this.path = appRootPath;
const date = new Date().toISOString().substring(0, 10);
const filePath = path.join(logPath, `${date}.log`);
this.stream = fs.createWriteStream(filePath, { flags: 'a' });
Expand Down Expand Up @@ -69,4 +69,4 @@ class Logger {
}
}

module.exports = new Logger('./log');
module.exports = (appRoot) => new Logger('./log', appRoot);
2 changes: 1 addition & 1 deletion JavaScript/d-messenger/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const fsp = require('node:fs').promises;
const path = require('node:path');
const staticServer = require('./lib/static.js');
const logger = require('./lib/logger.js');
const logger = require('./lib/logger.js')(process.cwd());
const common = require('./lib/common.js');
const config = require('./config.js');
const load = require('./lib/load.js')(config.sandbox);
Expand Down