This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component | |
| @Aspect | |
| public class PostRequestLogger { | |
| @Pointcut("@annotation(org.springframework.web.bind.annotation.PostMapping)") | |
| public void postAction() { | |
| } | |
| @Before("postAction()") | |
| public void logAction(JoinPoint joinPoint) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BASE_DIR=/app | |
| START_COMMAND="java -jar $BASE_DIR/app.jar" | |
| PID_FILE=$BASE_DIR/app.pid | |
| LOG_DIR=$BASE_DIR/logs | |
| start() { | |
| PID=`$START_COMMAND > $LOG_DIR/init.log 2>$LOG_DIR/init.error.log & echo $!` | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BASE_DIR=/app | |
| START_COMMAND="java -jar $BASE_DIR/app.jar" | |
| PID_FILE=$BASE_DIR/app.pid | |
| LOG_DIR=$BASE_DIR/logs | |
| start() { | |
| PID=`$START_COMMAND > $LOG_DIR/init.log 2>$LOG_DIR/init.error.log & echo $!` | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const gulp = require('gulp'); | |
| const gulpBabel= require('gulp-babel'); | |
| const sourceMaps = require('gulp-sourcemaps'); | |
| gulp.task('build', () => { | |
| gulp.src('src/**/*.js') | |
| .pipe(sourceMaps.init()) | |
| .pipe(gulpBabel({ | |
| "presets": [ | |
| [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const gulp = require('gulp'); | |
| const gulpBabel= require('gulp-babel'); | |
| const sourceMaps = require('gulp-sourcemaps'); | |
| gulp.task('build', () => { | |
| gulp.src('src/**/*.js') | |
| .pipe(sourceMaps.init()) | |
| .pipe(gulpBabel({ | |
| "presets": [ | |
| [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import moment from 'moment-timezone'; | |
| console.log(moment().tz('Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {createLogger, format, transports } from 'winston'; | |
| const {combine, timestamp, printf } = format; | |
| const myFormat = printf((info, opts) => { | |
| return `${info.time_is_money}: ${info.message}`; | |
| }); | |
| const logger = createLogger({ | |
| format: combine( | |
| timestamp({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = format((info, opts) => { | |
| if (opts.format) { | |
| info.timestamp = typeof opts.format === 'function' | |
| ? opts.format() | |
| : fecha.format(new Date(), opts.format); | |
| } | |
| if (!info.timestamp) { | |
| info.timestamp = new Date().toISOString(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {createLogger, format, transports } from 'winston'; | |
| const {combine, timestamp, prettyPrint } = format; | |
| const logger = createLogger({ | |
| format: combine( | |
| timestamp(), | |
| prettyPrint() | |
| ), | |
| transports: [ | |
| new transports.File({ |