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 { URL } from "@fastly/as-url"; | |
import { RegExp } from "assemblyscript-regex"; | |
import { Dictionary } from "@fastly/as-compute" | |
import { JSON } from "assemblyscript-json"; | |
// import { md5 } from "hash-wasm"; | |
function normalizePath(url: URL): URL { | |
const filenameRegEx = new RegExp(".*\.([a-zA-Z0-9]{1,11})$", "g"); | |
let path = url.pathname; |
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 util = require('util') | |
const path = require( 'path' ) | |
const winston = require( 'winston' ); | |
const { createLogger, transports, format } = winston | |
const { Console, File } = transports | |
const { timestamp } = format | |
// Adapted from https://github.com/winstonjs/winston/issues/1427 | |
const commonConfig = { | |
handleExceptions: true, |
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 winston from 'winston'; | |
import util from 'util'; | |
const utilFormat = (enableColor: boolean) => { | |
const printFormat = winston.format.printf(({ level, message, timestamp }) => `${timestamp} ${level}: ${message}`); | |
const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS' }), { | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
transform: (info: any) => { | |
const args = info[Symbol.for('splat')] || []; | |
info.message = util.formatWithOptions({ colors: enableColor }, info.message, ...args); |