This file contains 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
# CI name | |
name: Run linters and specs | |
# The on key is used to define when | |
# the CI should be triggered, aka Event | |
on: | |
# When someone push or merge a pull request | |
# inside the main branch | |
push: | |
branches: |
This file contains 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 morgan, { StreamOptions } from "morgan"; | |
import { IncomingMessage } from "http"; | |
import Logger from "../lib/logger"; | |
interface Request extends IncomingMessage { | |
body: { | |
query: String; | |
}; |
This file contains 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 morgan, { StreamOptions } from "morgan"; | |
import Logger from "../lib/logger"; | |
// Override the stream method by telling | |
// Morgan to use our custom logger instead of the console.log. | |
const stream: StreamOptions = { | |
// Use the http severity | |
write: (message) => Logger.http(message), | |
}; |
This file contains 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 winston from 'winston' | |
// Define your severity levels. | |
// With them, You can create log files, | |
// see or hide levels based on the running ENV. | |
const levels = { | |
error: 0, | |
warn: 1, | |
info: 2, | |
http: 3, |
This file contains 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 express from "express"; | |
import Logger from "./lib/logger"; | |
const app = express(); | |
const PORT = 3000; | |
app.get("/logger", (_, res) => { | |
Logger.error("This is an error log"); | |
Logger.warn("This is a warn log"); |
This file contains 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 winston from 'winston' | |
const levels = { | |
error: 0, | |
warn: 1, | |
info: 2, | |
http: 3, | |
debug: 4, | |
} |
This file contains 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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |