Created
June 21, 2019 20:45
-
-
Save ddialar/b49cc0f1ed9c5259e33e45c6d99397f6 to your computer and use it in GitHub Desktop.
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 log4js from 'log4js'; | |
var loggerConfiguration = { | |
appenders: { | |
console: { | |
type: 'console', | |
layout: { | |
type: 'pattern', | |
pattern: '[%r] (%35.35c) - [%[%5.5p%]] - %m%' | |
} | |
}, | |
file: { | |
type: 'file', | |
layout: { | |
type: 'pattern', | |
pattern: '[%d] (%35.35c) - [%5.5p] - %m%' | |
}, | |
filename: process.env.LOGGER_FILE | |
}, | |
}, | |
categories: { | |
default: { | |
appenders: ['console', 'file'], | |
filename: process.env.LOGGER_FILE | |
} | |
} | |
}; | |
log4js.configure(loggerConfiguration); | |
export default log4js; |
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 log4js from './core/common/logger'; | |
const logger = log4js.getLogger('server'); | |
import { ApolloServer } from 'apollo-server'; | |
import resolvers from './resolvers'; | |
import typeDefs from './schema'; | |
const server = new ApolloServer({ resolvers, typeDefs }); | |
server | |
.listen() | |
.then(({ url }) => logger.info(`Server ready at ${url}`)); | |
if ((module as any).hot) { | |
(module as any).hot.accept(); | |
(module as any).hot.dispose(() => server.stop()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment