Skip to content

Commit

Permalink
refactor: Replace bunyan with winston for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jrassa committed Mar 6, 2024
1 parent 96dde84 commit 68a166f
Show file tree
Hide file tree
Showing 49 changed files with 664 additions and 432 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Project Specific
###################

# Development logs
/logs

# Typescript Build
/public

Expand Down
96 changes: 45 additions & 51 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,61 +371,55 @@ module.exports = {
/**
* Logging Settings
*/

// Application logging and logstash
logger: {
application: [
// Console logger
{
stream: 'process.stdout',
application: {
console: {
enabled: true,
level: 'warn'
} //,
// Rotating file logger
//{
// type: 'rotating-file',
// level: 'info',
// path: '/usr/local/var/log/mean2/application.log',
// period: '1d',
// count: 1
//},
// Logstash logger
//{
// type: 'raw',
// level: 'info',
// stream: logstash.createStream({
// host: 'localhost',
// port: 4561
// })
//}
],
audit: [
// Console logger (audit logger must be 'info' level)
{
stream: 'process.stdout',
},
file: {
enabled: false,
level: 'warn',
directory: '/var/log/rest-server',
filename: 'application-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
zippedArchive: true,
maxSize: '20m',
maxFiles: '7d'
}
},
audit: {
console: {
enabled: false,
level: 'info'
} //,
//{
// type: 'rotating-file',
// level: 'info',
// path: '/usr/local/var/log/mean2/audit.log',
// period: '1d',
// count: 1
//}
],
metrics: [
// Console logger (audit logger must be 'info' level)
{
stream: 'process.stdout',
},
file: {
enabled: true,
level: 'info',
directory: '/var/log/rest-server',
filename: 'audit-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
zippedArchive: true,
maxSize: '20m',
maxFiles: '7d'
}
},
metrics: {
console: {
enabled: false,
level: 'info'
} //,
//{
// type: 'rotating-file',
// level: 'info',
// path: '/usr/local/var/log/mean2/metrics.log',
// period: '1d',
// count: 1
//}
]
},
file: {
enabled: true,
level: 'info',
directory: '/var/log/rest-server',
filename: 'metrics-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
zippedArchive: true,
maxSize: '20m',
maxFiles: '7d'
}
}
},

/**
Expand Down
33 changes: 27 additions & 6 deletions config/development.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,34 @@ module.exports = {
* Logging Settings
*/
logger: {
application: [
// Console logger
{
stream: 'process.stdout',
level: 'debug'
application: {
console: {
level: 'info'
},
file: {
enabled: true,
level: 'debug',
directory: 'logs'
}
]
},
audit: {
console: {
enabled: true
},
file: {
enabled: false,
directory: 'logs'
}
},
metrics: {
console: {
enabled: true
},
file: {
enabled: false,
directory: 'logs'
}
}
},

/**
Expand Down
21 changes: 16 additions & 5 deletions config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,23 @@ module.exports = {

// Disable loggers for tests
logger: {
application: [
{
stream: 'process.stdout',
application: {
console: {
level: 'error'
},
file: {
enabled: false
}
],
audit: []
},
audit: {
file: {
enabled: false
}
},
metrics: {
file: {
enabled: false
}
}
}
};
Loading

0 comments on commit 68a166f

Please sign in to comment.