chore: logging++

This commit is contained in:
cha0s 2022-04-04 04:42:01 -05:00
parent a6dff85d99
commit 3e889db9a1
15 changed files with 68 additions and 47 deletions

View File

@ -12,6 +12,7 @@ const {
} = process.env; } = process.env;
const debug = D('@flecks/core/cli'); const debug = D('@flecks/core/cli');
const debugSilly = debug.extend('silly');
// Guarantee local node_modules path. // Guarantee local node_modules path.
const defaultNodeModules = resolve(join(FLECKS_CORE_ROOT, 'node_modules')); const defaultNodeModules = resolve(join(FLECKS_CORE_ROOT, 'node_modules'));
@ -40,7 +41,7 @@ const environmentUpdates = (
} }
: undefined; : undefined;
if (environmentUpdates) { if (environmentUpdates) {
debug('updating environment, forking with %O...', environmentUpdates); debugSilly('updating environment, forking with %O...', environmentUpdates);
const forkOptions = { const forkOptions = {
env: { env: {
...process.env, ...process.env,
@ -61,13 +62,13 @@ else {
const child = await fn(...args); const child = await fn(...args);
if ('object' !== typeof child) { if ('object' !== typeof child) {
const code = 'undefined' !== typeof child ? child : 0; const code = 'undefined' !== typeof child ? child : 0;
debug('action returned code %d', code); debugSilly('action returned code %d', code);
process.exitCode = code; process.exitCode = code;
return; return;
} }
try { try {
const code = await processCode(child); const code = await processCode(child);
debug('action exited with code %d', code); debugSilly('action exited with code %d', code);
process.exitCode = code; process.exitCode = code;
} }
catch (error) { catch (error) {
@ -84,9 +85,9 @@ else {
.usage('[command] [...]'); .usage('[command] [...]');
// Bootstrap. // Bootstrap.
(async () => { (async () => {
debug('bootstrapping flecks...'); debugSilly('bootstrapping flecks...');
const flecks = Flecks.bootstrap(); const flecks = Flecks.bootstrap();
debug('bootstrapped'); debugSilly('bootstrapped');
// Register commands. // Register commands.
const commands = flecks.invokeMerge('@flecks/core.commands', program); const commands = flecks.invokeMerge('@flecks/core.commands', program);
const keys = Object.keys(commands).sort(); const keys = Object.keys(commands).sort();
@ -98,7 +99,7 @@ else {
name = keys[i], name = keys[i],
options = [], options = [],
} = commands[keys[i]]; } = commands[keys[i]];
debug('adding command %s...', name); debugSilly('adding command %s...', name);
const cmd = program.command(name); const cmd = program.command(name);
cmd.description(description); cmd.description(description);
for (let i = 0; i < args.length; ++i) { for (let i = 0; i < args.length; ++i) {

View File

@ -21,8 +21,9 @@ module.exports = (name) => {
D.formatters.o = undefined; D.formatters.o = undefined;
D.formatters.O = undefined; D.formatters.O = undefined;
} }
const type = 'server' === process.env.FLECKS_CORE_BUILD_TARGET ? 'error' : 'debug';
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
D.log = console.debug.bind(console); D.log = console[type].bind(console);
} }
return D(name); return D(name);
}; };

View File

@ -14,6 +14,7 @@ import D from './debug';
import Middleware from './middleware'; import Middleware from './middleware';
const debug = D('@flecks/core/flecks'); const debug = D('@flecks/core/flecks');
const debugSilly = debug.extend('silly');
export const ById = Symbol.for('@flecks/core.byId'); export const ById = Symbol.for('@flecks/core.byId');
export const ByType = Symbol.for('@flecks/core.byType'); export const ByType = Symbol.for('@flecks/core.byType');
@ -55,13 +56,13 @@ export default class Flecks {
this.flecks = {}; this.flecks = {};
this.platforms = platforms; this.platforms = platforms;
const entries = Object.entries(flecks); const entries = Object.entries(flecks);
debug('paths: %O', entries.map(([fleck]) => fleck)); debugSilly('paths: %O', entries.map(([fleck]) => fleck));
for (let i = 0; i < entries.length; i++) { for (let i = 0; i < entries.length; i++) {
const [fleck, M] = entries[i]; const [fleck, M] = entries[i];
this.registerFleck(fleck, M); this.registerFleck(fleck, M);
} }
this.configureFlecks(); this.configureFlecks();
debug('config: %O', this.config); debugSilly('config: %O', this.config);
} }
configureFleck(fleck) { configureFleck(fleck) {
@ -204,7 +205,7 @@ export default class Flecks {
[ByType]: types, [ByType]: types,
}; };
hotGathered.set(hook, {idAttribute, gathered, typeAttribute}); hotGathered.set(hook, {idAttribute, gathered, typeAttribute});
debug("gathered '%s': %O", hook, gathered); debug("gathered '%s': %O", hook, Object.keys(gathered[ByType]));
return gathered; return gathered;
} }
@ -257,7 +258,7 @@ export default class Flecks {
} }
invokeFleck(hook, fleck, ...args) { invokeFleck(hook, fleck, ...args) {
debug('invokeFleck(%s, %s, ...)', hook, fleck); debugSilly('invokeFleck(%s, %s, ...)', hook, fleck);
if (!this.hooks[hook]) { if (!this.hooks[hook]) {
return undefined; return undefined;
} }
@ -346,7 +347,7 @@ export default class Flecks {
} }
makeMiddleware(hook) { makeMiddleware(hook) {
debug('makeMiddleware(...): %s', hook); debugSilly('makeMiddleware(...): %s', hook);
if (!this.hooks[hook]) { if (!this.hooks[hook]) {
return Promise.resolve(); return Promise.resolve();
} }
@ -356,7 +357,7 @@ export default class Flecks {
} }
const middleware = flecks const middleware = flecks
.filter((fleck) => this.fleckImplements(fleck, hook)); .filter((fleck) => this.fleckImplements(fleck, hook));
debug('middleware: %O', middleware); debugSilly('middleware: %O', middleware);
const instance = new Middleware(middleware.map((fleck) => this.invokeFleck(hook, fleck))); const instance = new Middleware(middleware.map((fleck) => this.invokeFleck(hook, fleck)));
return async (...args) => { return async (...args) => {
const next = args.pop(); const next = args.pop();
@ -422,13 +423,13 @@ export default class Flecks {
} }
registerFleck(fleck, M) { registerFleck(fleck, M) {
debug('registering %s...', fleck); debugSilly('registering %s...', fleck);
this.flecks[fleck] = M; this.flecks[fleck] = M;
if (M.default) { if (M.default) {
const {default: {[Hooks]: hooks}} = M; const {default: {[Hooks]: hooks}} = M;
if (hooks) { if (hooks) {
const keys = Object.keys(hooks); const keys = Object.keys(hooks);
debug("hooks for '%s': %O", fleck, keys); debugSilly("hooks for '%s': %O", fleck, keys);
for (let j = 0; j < keys.length; j++) { for (let j = 0; j < keys.length; j++) {
const key = keys[j]; const key = keys[j];
if (!this.hooks[key]) { if (!this.hooks[key]) {
@ -439,7 +440,7 @@ export default class Flecks {
} }
} }
else { else {
debug("'%s' has no default export: %O", fleck, M); debugSilly("'%s' has no default export", fleck);
} }
} }

View File

@ -19,6 +19,7 @@ import {targetNeutrino} from '../commands';
import Flecks from '../flecks'; import Flecks from '../flecks';
const debug = D('@flecks/core/build/webpack.config.js'); const debug = D('@flecks/core/build/webpack.config.js');
const debugSilly = debug.extend('silly');
const { const {
FLECKS_CORE_BUILD_LIST = '', FLECKS_CORE_BUILD_LIST = '',
@ -78,6 +79,6 @@ export default (async () => {
debug('no webpack configuration found! aborting...'); debug('no webpack configuration found! aborting...');
await new Promise(() => {}); await new Promise(() => {});
} }
debug('webpack configurations %O', webpackConfigs); debugSilly('webpack configurations %O', webpackConfigs);
return webpackConfigs; return webpackConfigs;
})(); })();

View File

@ -12,6 +12,7 @@ const {
} = process.env; } = process.env;
const debug = D('@flecks/core/commands'); const debug = D('@flecks/core/commands');
const debugSilly = debug.extend('silly');
const flecksRoot = normalize(FLECKS_CORE_ROOT); const flecksRoot = normalize(FLECKS_CORE_ROOT);
export const processCode = (child) => new Promise((resolve, reject) => { export const processCode = (child) => new Promise((resolve, reject) => {
@ -23,7 +24,8 @@ export const processCode = (child) => new Promise((resolve, reject) => {
}); });
export const spawnWith = (cmd, opts = {}) => { export const spawnWith = (cmd, opts = {}) => {
debug("spawning: '%s' with options: %O", cmd.join(' '), opts); debug("spawning: '%s'", cmd.join(' '));
debugSilly('with options: %O', opts);
const child = spawn(cmd[0], cmd.slice(1), { const child = spawn(cmd[0], cmd.slice(1), {
...opts, ...opts,
env: { env: {

View File

@ -28,6 +28,7 @@ const {
} = process.env; } = process.env;
const debug = D('@flecks/core/flecks/server'); const debug = D('@flecks/core/flecks/server');
const debugSilly = debug.extend('silly');
export default class ServerFlecks extends Flecks { export default class ServerFlecks extends Flecks {
@ -83,7 +84,8 @@ export default class ServerFlecks extends Flecks {
else { else {
configType = 'parameter'; configType = 'parameter';
} }
debug('bootstrap configuration (%s): %O', configType, config); debug('bootstrap configuration (%s)', configType);
debugSilly(config);
// Make resolver. // Make resolver.
const resolver = this.makeResolver(config, platforms, root); const resolver = this.makeResolver(config, platforms, root);
// Rewrite aliased config keys. // Rewrite aliased config keys.
@ -183,7 +185,7 @@ export default class ServerFlecks extends Flecks {
static installCompilers(rcs, resolver) { static installCompilers(rcs, resolver) {
const paths = Object.keys(resolver); const paths = Object.keys(resolver);
debug('rcs: %O', rcs); debugSilly('rcs: %O', rcs);
// Merge aliases; // Merge aliases;
const aliases = Object.fromEntries( const aliases = Object.fromEntries(
Object.entries({ Object.entries({
@ -202,7 +204,7 @@ export default class ServerFlecks extends Flecks {
.map(([from, to]) => [from, to.endsWith('/index') ? to.slice(0, -6) : to]), .map(([from, to]) => [from, to.endsWith('/index') ? to.slice(0, -6) : to]),
); );
if (Object.keys(aliases).length > 0) { if (Object.keys(aliases).length > 0) {
debug('aliases: %O', aliases); debugSilly('aliases: %O', aliases);
} }
const exts = this.exts(rcs); const exts = this.exts(rcs);
const enhancedResolver = enhancedResolve.create.sync({ const enhancedResolver = enhancedResolve.create.sync({
@ -212,7 +214,7 @@ export default class ServerFlecks extends Flecks {
// Stub server-unfriendly modules. // Stub server-unfriendly modules.
const stubs = this.stubs(['server'], rcs); const stubs = this.stubs(['server'], rcs);
if (stubs.length > 0) { if (stubs.length > 0) {
debug('stubbing: %O', stubs); debugSilly('stubbing: %O', stubs);
} }
// Do we need to get up in `require()`'s guts? // Do we need to get up in `require()`'s guts?
if ( if (
@ -248,7 +250,7 @@ export default class ServerFlecks extends Flecks {
if (needCompilation.length > 0) { if (needCompilation.length > 0) {
// Augment the compilations with babel config from flecksrc. // Augment the compilations with babel config from flecksrc.
const rcBabelConfig = babelmerge.all(this.babel(rcs).map(([, babel]) => babel)); const rcBabelConfig = babelmerge.all(this.babel(rcs).map(([, babel]) => babel));
debug('.flecksrc: babel: %O', rcBabelConfig); debugSilly('.flecksrc: babel: %O', rcBabelConfig);
// Key flecks needing compilation by their roots, so we can compile all common roots with a // Key flecks needing compilation by their roots, so we can compile all common roots with a
// single invocation of `@babel/register`. // single invocation of `@babel/register`.
const compilationRootMap = {}; const compilationRootMap = {};
@ -296,7 +298,7 @@ export default class ServerFlecks extends Flecks {
ignore: [ignore], ignore: [ignore],
only: [only], only: [only],
}; };
debug('compiling %O with %j', compiling, config); debugSilly('compiling %O with %j', compiling, config);
compilations.push({ compilations.push({
ignore, ignore,
only, only,
@ -313,7 +315,7 @@ export default class ServerFlecks extends Flecks {
} }
return undefined; return undefined;
}; };
debug('pirating exts: %O', exts); debugSilly('pirating exts: %O', exts);
addHook( addHook(
(code, request) => { (code, request) => {
const compilation = findCompiler(request).compile(code, request); const compilation = findCompiler(request).compile(code, request);
@ -344,7 +346,7 @@ export default class ServerFlecks extends Flecks {
const {load} = R('js-yaml'); const {load} = R('js-yaml');
const filename = join(resolvedRoot, 'build', FLECKS_YML); const filename = join(resolvedRoot, 'build', FLECKS_YML);
const buffer = readFileSync(filename, 'utf8'); const buffer = readFileSync(filename, 'utf8');
debug('parsing configuration from YML...'); debugSilly('parsing configuration from YML...');
return ['YML', load(buffer, {filename}) || {}]; return ['YML', load(buffer, {filename}) || {}];
} }
catch (error) { catch (error) {
@ -553,7 +555,7 @@ export default class ServerFlecks extends Flecks {
.filter(([fleck]) => this.constructor.fleckIsCompiled(resolver, fleck)); .filter(([fleck]) => this.constructor.fleckIsCompiled(resolver, fleck));
if (needCompilation.length > 0) { if (needCompilation.length > 0) {
const rcBabel = this.babel(); const rcBabel = this.babel();
debug('.flecksrc: babel: %O', rcBabel); debugSilly('.flecksrc: babel: %O', rcBabel);
// Alias and de-externalize. // Alias and de-externalize.
needCompilation needCompilation
.sort(([l], [r]) => (l < r ? 1 : -1)) .sort(([l], [r]) => (l < r ? 1 : -1))
@ -565,7 +567,7 @@ export default class ServerFlecks extends Flecks {
allowlist.push(fleck); allowlist.push(fleck);
config.resolve.alias config.resolve.alias
.set(fleck, alias); .set(fleck, alias);
debug('%s runtime de-externalized %s, alias: %s', runtime, fleck, alias); debugSilly('%s runtime de-externalized %s, alias: %s', runtime, fleck, alias);
}); });
// Set up compilation at each root. // Set up compilation at each root.
Array.from(new Set( Array.from(new Set(
@ -579,7 +581,7 @@ export default class ServerFlecks extends Flecks {
const sourceroot = join(sourcepath, '..'); const sourceroot = join(sourcepath, '..');
additionalModuleDirs.push(join(sourceroot, 'node_modules')); additionalModuleDirs.push(join(sourceroot, 'node_modules'));
const configFile = this.buildConfig('babel.config.js'); const configFile = this.buildConfig('babel.config.js');
debug('compiling: %s with %s', root, configFile); debugSilly('compiling: %s with %s', root, configFile);
const babel = { const babel = {
configFile, configFile,
// Augment the compiler with babel config from flecksrc. // Augment the compiler with babel config from flecksrc.

View File

@ -1,4 +1,5 @@
import {join} from 'path'; import {join} from 'path';
import {inspect} from 'util';
import airbnb from '@neutrinojs/airbnb'; import airbnb from '@neutrinojs/airbnb';
import neutrino from 'neutrino'; import neutrino from 'neutrino';
@ -11,6 +12,11 @@ const {
FLECKS_CORE_ROOT = process.cwd(), FLECKS_CORE_ROOT = process.cwd(),
} = process.env; } = process.env;
const {defaultOptions} = inspect;
defaultOptions.breakLength = 160;
defaultOptions.compact = 6;
defaultOptions.sorted = true;
export {dump as dumpYml, load as loadYml} from 'js-yaml'; export {dump as dumpYml, load as loadYml} from 'js-yaml';
export { export {

View File

@ -7,10 +7,11 @@ import FlecksContext from '@flecks/react/context';
import gatherComponents from './gather-components'; import gatherComponents from './gather-components';
const debug = D('@flecks/react/root'); const debug = D('@flecks/react/root');
const debugSilly = debug.extend('silly');
export default async (flecks, req) => { export default async (flecks, req) => {
const Roots = flecks.invoke('@flecks/react.roots', req); const Roots = flecks.invoke('@flecks/react.roots', req);
debug('roots: %O', Roots); debugSilly('roots: %O', Roots);
const Providers = await flecks.invokeSequentialAsync('@flecks/react.providers', req); const Providers = await flecks.invokeSequentialAsync('@flecks/react.providers', req);
const FlattenedProviders = []; const FlattenedProviders = [];
for (let i = 0; i < Providers.length; i++) { for (let i = 0; i < Providers.length; i++) {
@ -19,7 +20,7 @@ export default async (flecks, req) => {
FlattenedProviders.push(...(Array.isArray(Provider[0]) ? Provider : [Provider])); FlattenedProviders.push(...(Array.isArray(Provider[0]) ? Provider : [Provider]));
} }
} }
debug('providers: %O', FlattenedProviders); debugSilly('providers: %O', FlattenedProviders);
return () => { return () => {
const RootElements = [[FlecksContext.Provider, {value: flecks}]] const RootElements = [[FlecksContext.Provider, {value: flecks}]]
.concat(FlattenedProviders) .concat(FlattenedProviders)

View File

@ -6,6 +6,7 @@ import session from 'express-session';
import createClient from '../create-client'; import createClient from '../create-client';
const debug = D('@flecks/redis/session'); const debug = D('@flecks/redis/session');
const debugSilly = debug.extend('silly');
const RedisStore = ConnectRedis(session); const RedisStore = ConnectRedis(session);
@ -22,7 +23,7 @@ export default {
const pubClient = createClient(flecks); const pubClient = createClient(flecks);
const subClient = createClient(flecks); const subClient = createClient(flecks);
await Promise.all([pubClient.connect(), subClient.connect()]); await Promise.all([pubClient.connect(), subClient.connect()]);
debug('creating adapter'); debugSilly('creating adapter');
return { return {
adapter: redisAdapter(pubClient, subClient), adapter: redisAdapter(pubClient, subClient),
}; };

View File

@ -6,6 +6,7 @@ import createReducer from './store/create-reducer';
import configureStore from './store'; import configureStore from './store';
const debug = D('@flecks/redux/server'); const debug = D('@flecks/redux/server');
const debugSilly = debug.extend('silly');
export default { export default {
[Hooks]: { [Hooks]: {
@ -17,7 +18,7 @@ export default {
Object.values(slices).map(({hydrateServer}) => hydrateServer?.(req, flecks)), Object.values(slices).map(({hydrateServer}) => hydrateServer?.(req, flecks)),
); );
const preloadedState = reducer(undefined, hydrateServer({flecks, req})); const preloadedState = reducer(undefined, hydrateServer({flecks, req}));
debug( debugSilly(
'creating redux store with slices(%O) and state(%O)', 'creating redux store with slices(%O) and state(%O)',
Object.keys(slices), Object.keys(slices),
preloadedState, preloadedState,

View File

@ -7,21 +7,22 @@ import {start} from 'repl';
import {D} from '@flecks/core'; import {D} from '@flecks/core';
const debug = D('@flecks/repl'); const debug = D('@flecks/repl');
const debugSilly = debug.extend('silly');
export async function createReplServer(flecks) { export async function createReplServer(flecks) {
const {id} = flecks.get('@flecks/core'); const {id} = flecks.get('@flecks/core');
const context = flecks.invokeFlat('@flecks/repl.context') const context = flecks.invokeFlat('@flecks/repl.context')
.reduce((r, vars) => ({...r, ...vars}), {flecks}); .reduce((r, vars) => ({...r, ...vars}), {flecks});
debug( debug(
'context = %O', 'Object.keys(context) === %O',
Object.fromEntries(Object.entries(context).map(([key]) => [key, '...'])), Object.keys(context),
); );
const commands = {}; const commands = {};
Object.entries( Object.entries(
flecks.invokeFlat('@flecks/repl.commands').reduce((r, commands) => ({...r, ...commands}), {}), flecks.invokeFlat('@flecks/repl.commands').reduce((r, commands) => ({...r, ...commands}), {}),
).forEach(([key, value]) => { ).forEach(([key, value]) => {
commands[key] = value; commands[key] = value;
debug('registered command: %s', key); debugSilly('registered command: %s', key);
}); });
const netServer = createServer((socket) => { const netServer = createServer((socket) => {
debug('client connection to repl established'); debug('client connection to repl established');

View File

@ -7,7 +7,7 @@ import createIntercom from './create-intercom';
import ServerSocket from './socket'; import ServerSocket from './socket';
const debug = D('@flecks/socket/server/sockets'); const debug = D('@flecks/socket/server/sockets');
const debugSilly = D('@flecks/socket/server/sockets:silly'); const debugSilly = debug.extend('silly');
export default class SocketServer { export default class SocketServer {
@ -16,9 +16,9 @@ export default class SocketServer {
this.flecks = flecks; this.flecks = flecks;
this.httpServer = httpServer; this.httpServer = httpServer;
const hooks = flecks.invokeMerge('@flecks/socket.intercom'); const hooks = flecks.invokeMerge('@flecks/socket.intercom');
debug('intercom hooks(%O)', hooks); debugSilly('intercom hooks(%O)', hooks);
this.localIntercom = async ({payload, type}, fn) => { this.localIntercom = async ({payload, type}, fn) => {
debug('customHook: %s(%o)', type, payload); debugSilly('customHook: %s(%o)', type, payload);
if (hooks[type]) { if (hooks[type]) {
fn(await hooks[type](payload, this)); fn(await hooks[type](payload, this));
} }

View File

@ -3,14 +3,15 @@ import passport from 'passport';
import LogOps from 'passport/lib/http/request'; import LogOps from 'passport/lib/http/request';
const debug = D('@flecks/user/passport'); const debug = D('@flecks/user/passport');
const debugSilly = debug.extend('silly');
export default { export default {
[Hooks]: { [Hooks]: {
'@flecks/db/server.models': Flecks.provide(require.context('./models', false, /\.js$/)), '@flecks/db/server.models': Flecks.provide(require.context('./models', false, /\.js$/)),
'@flecks/web/server.request.route': (flecks) => (req, res, next) => { '@flecks/web/server.request.route': (flecks) => (req, res, next) => {
debug('@flecks/web/server.request.route: passport.initialize()'); debugSilly('@flecks/web/server.request.route: passport.initialize()');
passport.initialize()(req, res, () => { passport.initialize()(req, res, () => {
debug('@flecks/web/server.request.route: passport.session()'); debugSilly('@flecks/web/server.request.route: passport.session()');
passport.session()(req, res, () => { passport.session()(req, res, () => {
if (!req.user) { if (!req.user) {
const {User} = flecks.get('$flecks/db.models'); const {User} = flecks.get('$flecks/db.models');
@ -58,9 +59,9 @@ export default {
}, },
}), }),
'@flecks/socket/server.request.socket': (flecks) => (socket, next) => { '@flecks/socket/server.request.socket': (flecks) => (socket, next) => {
debug('@flecks/socket/server.request.socket: passport.initialize()'); debugSilly('@flecks/socket/server.request.socket: passport.initialize()');
passport.initialize()(socket.handshake, undefined, () => { passport.initialize()(socket.handshake, undefined, () => {
debug('@flecks/socket/server.request.socket: passport.session()'); debugSilly('@flecks/socket/server.request.socket: passport.session()');
passport.session()(socket.handshake, undefined, async () => { passport.session()(socket.handshake, undefined, async () => {
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
if (!socket.handshake.user) { if (!socket.handshake.user) {

View File

@ -3,6 +3,7 @@ import express from 'express';
import expressSession from 'express-session'; import expressSession from 'express-session';
const debug = D('@flecks/user/session'); const debug = D('@flecks/user/session');
const debugSilly = debug.extend('silly');
export default { export default {
[Hooks]: { [Hooks]: {
@ -19,19 +20,19 @@ export default {
'@flecks/web/server.request.route': (flecks) => { '@flecks/web/server.request.route': (flecks) => {
const urle = express.urlencoded({extended: true}); const urle = express.urlencoded({extended: true});
return (req, res, next) => { return (req, res, next) => {
debug('@flecks/web/server.request.route: express.urlencoded()'); debugSilly('@flecks/web/server.request.route: express.urlencoded()');
urle(req, res, (error) => { urle(req, res, (error) => {
if (error) { if (error) {
next(error); next(error);
return; return;
} }
debug('@flecks/web/server.request.route: session()'); debugSilly('@flecks/web/server.request.route: session()');
flecks.get('$flecks/user.session')(req, res, (error) => { flecks.get('$flecks/user.session')(req, res, (error) => {
if (error) { if (error) {
next(error); next(error);
return; return;
} }
debug('session ID: %s', req.session.id); debugSilly('session ID: %s', req.session.id);
next(); next();
}); });
}); });
@ -47,7 +48,7 @@ export default {
})); }));
}, },
'@flecks/socket/server.request.socket': (flecks) => (socket, next) => { '@flecks/socket/server.request.socket': (flecks) => (socket, next) => {
debug('@flecks/socket/server.request.socket: session()'); debugSilly('@flecks/socket/server.request.socket: session()');
flecks.get('$flecks/user.session')(socket.handshake, {}, () => { flecks.get('$flecks/user.session')(socket.handshake, {}, () => {
const id = socket.handshake.session?.id; const id = socket.handshake.session?.id;
socket.join(id); socket.join(id);

View File

@ -129,6 +129,7 @@ export default {
* (webpack-dev-server) Webpack stats output. * (webpack-dev-server) Webpack stats output.
*/ */
devStats: { devStats: {
assets: false,
chunks: false, chunks: false,
colors: true, colors: true,
modules: false, modules: false,