Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8bf2c40
feat(core-logger-pino): initial implementation
Feb 21, 2019
b7e53be
refactor: remove emojis from log, unnecessary log processing
Feb 21, 2019
4afd1b5
refactor: remove emojis from log, unnecessary log processing
Feb 21, 2019
6d46529
feat(core-logger-pino): daily rotating log
Feb 25, 2019
63eb8ea
test(core-logger-pino): adjust failing tests
Feb 25, 2019
f0287ad
feat(core-logger-pino): multi stream logging
Feb 25, 2019
e9f5527
fix(core-logger-pino): support for prettier in CLI
Feb 25, 2019
84f9f6b
test(core-blockchain): change log message assertion
Feb 25, 2019
7f4f5f5
Merge branch 'develop' into pino
Feb 25, 2019
98394ad
chore: deprecate core-logger-winston
Feb 25, 2019
b88bf54
chore: deprecate core-logger-winston
Feb 25, 2019
7d2afc0
test(core-blockchain): change log message assertion
Feb 25, 2019
23811bf
Merge branch 'develop' into pino
faustbrian Feb 25, 2019
23e58c4
chore: update CircleCI config
Feb 25, 2019
724b34d
Merge remote-tracking branch 'origin/pino' into pino
Feb 25, 2019
d6db662
Merge branch 'develop' into pino
faustbrian Feb 25, 2019
32c2fe6
test(core-blockchain): change log message assertion
Feb 25, 2019
9206598
refactor(core-logger-pino): simpler configuration
Feb 25, 2019
bdad488
refactor(core-logger-pino): remove logger name
Feb 25, 2019
8bb6726
refactor: remove the verbose log level
Feb 25, 2019
791ba2c
Revert "refactor: remove the verbose log level"
Feb 25, 2019
97db66d
Merge branch 'develop' into pino
spkjp Feb 25, 2019
4235fea
refactor: remove hostname and pid
spkjp Feb 25, 2019
677326b
Merge branch '2.3' into pino
Feb 26, 2019
009b6aa
fix: resolve conflicts that cause the test setup to fail
Feb 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- ./packages/core-jest-matchers/node_modules
- ./packages/core-json-rpc/node_modules
- ./packages/core-logger/node_modules
- ./packages/core-logger-winston/node_modules
- ./packages/core-logger-pino/node_modules
- ./packages/core-p2p/node_modules
- ./packages/core-snapshots/node_modules
- ./packages/core-test-utils/node_modules
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
- ./packages/core-jest-matchers/node_modules
- ./packages/core-json-rpc/node_modules
- ./packages/core-logger/node_modules
- ./packages/core-logger-winston/node_modules
- ./packages/core-logger-pino/node_modules
- ./packages/core-p2p/node_modules
- ./packages/core-snapshots/node_modules
- ./packages/core-test-utils/node_modules
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
- ./packages/core-jest-matchers/node_modules
- ./packages/core-json-rpc/node_modules
- ./packages/core-logger/node_modules
- ./packages/core-logger-winston/node_modules
- ./packages/core-logger-pino/node_modules
- ./packages/core-p2p/node_modules
- ./packages/core-snapshots/node_modules
- ./packages/core-test-utils/node_modules
Expand Down Expand Up @@ -317,10 +317,10 @@ jobs:
cd ~/core/.circleci && ./rebuild-db.sh && cd
~/core/packages/core-logger && yarn test:coverage
- run:
name: core-logger-winston
name: core-logger-pino
command: >-
cd ~/core/.circleci && ./rebuild-db.sh && cd
~/core/packages/core-logger-winston && yarn test:coverage
~/core/packages/core-logger-pino && yarn test:coverage
- run:
name: core-p2p
command: >-
Expand Down Expand Up @@ -389,7 +389,7 @@ jobs:
- ./packages/core-jest-matchers/node_modules
- ./packages/core-json-rpc/node_modules
- ./packages/core-logger/node_modules
- ./packages/core-logger-winston/node_modules
- ./packages/core-logger-pino/node_modules
- ./packages/core-p2p/node_modules
- ./packages/core-snapshots/node_modules
- ./packages/core-test-utils/node_modules
Expand Down Expand Up @@ -506,7 +506,7 @@ jobs:
- ./packages/core-jest-matchers/node_modules
- ./packages/core-json-rpc/node_modules
- ./packages/core-logger/node_modules
- ./packages/core-logger-winston/node_modules
- ./packages/core-logger-pino/node_modules
- ./packages/core-p2p/node_modules
- ./packages/core-snapshots/node_modules
- ./packages/core-test-utils/node_modules
Expand Down Expand Up @@ -556,10 +556,10 @@ jobs:
cd ~/core/.circleci && ./rebuild-db.sh && cd
~/core/packages/core-logger && yarn test:coverage
- run:
name: core-logger-winston
name: core-logger-pino
command: >-
cd ~/core/.circleci && ./rebuild-db.sh && cd
~/core/packages/core-logger-winston && yarn test:coverage
~/core/packages/core-logger-pino && yarn test:coverage
- run:
name: core-p2p
command: >-
Expand Down Expand Up @@ -628,7 +628,7 @@ jobs:
- ./packages/core-jest-matchers/node_modules
- ./packages/core-json-rpc/node_modules
- ./packages/core-logger/node_modules
- ./packages/core-logger-winston/node_modules
- ./packages/core-logger-pino/node_modules
- ./packages/core-p2p/node_modules
- ./packages/core-snapshots/node_modules
- ./packages/core-test-utils/node_modules
Expand Down
2 changes: 1 addition & 1 deletion deprecated/core-snapshots-cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const setUpLite = async options => {
await app.setUp("2.0.0", options, {
include: [
"@arkecosystem/core-logger",
"@arkecosystem/core-logger-winston",
"@arkecosystem/core-logger-pino",
"@arkecosystem/core-event-emitter",
"@arkecosystem/core-snapshots",
],
Expand Down
1 change: 0 additions & 1 deletion packages/core-api/__tests__/__support__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ async function setUp() {
await setUpContainer({
exclude: [
"@arkecosystem/core-webhooks",
"@arkecosystem/core-graphql",
"@arkecosystem/core-forger",
"@arkecosystem/core-json-rpc",
"@arkecosystem/core-api",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-api/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const plugin: Container.PluginDescriptor = {
alias: "api",
async register(container: Container.IContainer, options) {
if (!options.enabled) {
container.resolvePlugin<Logger.ILogger>("logger").info("Public API is disabled :grey_exclamation:");
container.resolvePlugin<Logger.ILogger>("logger").info("Public API is disabled");

return false;
}
Expand Down
1 change: 0 additions & 1 deletion packages/core-api/src/repositories/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Database, TransactionPool } from "@arkecosystem/core-interfaces";
import snakeCase from "lodash/snakeCase";
import { IRepository } from "../interfaces";


// TODO: Deprecate this with v1
export abstract class Repository implements IRepository {
public databaseService = app.resolvePlugin<Database.IDatabaseService>("database");
Expand Down
1 change: 0 additions & 1 deletion packages/core-api/src/repositories/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { IRepository } from "../interfaces";
import { Repository } from "./repository";
import { buildFilterQuery } from "./utils/build-filter-query";


// TODO: Deprecate this with v1
export class TransactionsRepository extends Repository implements IRepository {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export function transformPortsLegacy(config: any) {
const keys = [
"@arkecosystem/core-p2p",
"@arkecosystem/core-api",
"@arkecosystem/core-graphql",
"@arkecosystem/core-json-rpc",
"@arkecosystem/core-webhooks",
];
Expand Down
3 changes: 2 additions & 1 deletion packages/core-api/src/versions/2/node/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export class NodeController extends Controller {

public async configuration(request: Hapi.Request, h: Hapi.ResponseToolkit) {
try {
const transactionsBusinessRepository = app.resolvePlugin<Database.IDatabaseService>("database").transactionsBusinessRepository;
const transactionsBusinessRepository = app.resolvePlugin<Database.IDatabaseService>("database")
.transactionsBusinessRepository;
const feeStatisticsData = await transactionsBusinessRepository.getFeeStatistics();

const network = this.config.get("network");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export function transformPorts(config: any) {
const keys = [
"@arkecosystem/core-p2p",
"@arkecosystem/core-api",
"@arkecosystem/core-graphql",
"@arkecosystem/core-json-rpc",
"@arkecosystem/core-webhooks",
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ describe("constructor - networkStart", () => {
await __start(true);

expect(loggerWarn).toHaveBeenCalledWith(
"Ark Core is launched in Genesis Start mode. This is usually for starting the first node on the blockchain. Unless you know what you are doing, this is likely wrong. :warning:",
"Ark Core is launched in Genesis Start mode. This is usually for starting the first node on the blockchain. Unless you know what you are doing, this is likely wrong.",
);
expect(loggerInfo).toHaveBeenCalledWith("Starting Ark Core for a new world, welcome aboard :rocket:");
expect(loggerInfo).toHaveBeenCalledWith("Starting Ark Core for a new world, welcome aboard");
});

describe("dispatch", () => {
Expand All @@ -50,7 +50,7 @@ describe("constructor - networkStart", () => {
});

blockchain.dispatch("STOP");
expect(loggerError).toHaveBeenCalledWith("No action 'yooo' found :interrobang:");
expect(loggerError).toHaveBeenCalledWith("No action 'yooo' found");
});
});
});
Expand Down
8 changes: 4 additions & 4 deletions packages/core-blockchain/__tests__/blockchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ describe("Blockchain", () => {

expect(mockCallback.mock.calls.length).toBe(1);
expect(loggerInfo).toHaveBeenCalledWith(
`Block ${lastBlockCopy.data.height.toLocaleString()} disregarded because on a fork :knife_fork_plate:`,
`Block ${lastBlockCopy.data.height.toLocaleString()} disregarded because on a fork`,
);
expect(blockchain.getLastBlock().data.id).toBe(lastBlock.data.id);
});
Expand Down Expand Up @@ -249,7 +249,7 @@ describe("Blockchain", () => {

expect(mockCallback.mock.calls.length).toBe(1);
expect(loggerWarn).toHaveBeenCalledWith(
`Block ${lastBlockCopy.data.height.toLocaleString()} disregarded because verification failed :scroll:`,
`Block ${lastBlockCopy.data.height.toLocaleString()} disregarded because verification failed`,
);
expect(blockchain.getLastBlock().data.id).toBe(lastBlock.data.id);
});
Expand Down Expand Up @@ -355,7 +355,7 @@ describe("Blockchain", () => {

const debugMessage = `Blockchain not ready to accept new block at height ${lastBlock.data.height.toLocaleString()}. Last block: ${(
lastBlock.data.height - 2
).toLocaleString()} :warning:`;
).toLocaleString()}`;
expect(mockLoggerDebug).toHaveBeenCalledWith(debugMessage);

expect(blockchain.getLastBlock().data.height).toBe(lastBlock.data.height - 2);
Expand Down Expand Up @@ -447,7 +447,7 @@ describe("Blockchain", () => {

await blockchain.handleIncomingBlock(blocks101to155[54]);

expect(loggerInfo).toHaveBeenCalledWith("Block disregarded because blockchain is not ready :exclamation:");
expect(loggerInfo).toHaveBeenCalledWith("Block disregarded because blockchain is not ready");
blockchain.state.started = true;

mockGetSlotNumber.mockRestore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Accept handler", () => {
blockchain.state.forkedBlock = new Block(blocks2to100[0]);

expect(await handler.execute()).toBe(BlockProcessorResult.Accepted);
expect(loggerInfo).toHaveBeenCalledWith("Successfully recovered from fork :star2:");
expect(loggerInfo).toHaveBeenCalledWith("Successfully recovered from fork");
expect(blockchain.state.forkedBlock).toBe(null);
});

Expand Down
30 changes: 13 additions & 17 deletions packages/core-blockchain/__tests__/state-machine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe("State Machine", () => {
const logger = container.resolvePlugin("logger");
const loggerInfo = jest.spyOn(logger, "info");
actionMap.downloadPaused();
expect(loggerInfo).lastCalledWith("Blockchain download paused :clock1030:");
expect(loggerInfo).lastCalledWith("Blockchain download paused");
});
});

Expand All @@ -222,15 +222,15 @@ describe("State Machine", () => {
const logger = container.resolvePlugin("logger");
const loggerInfo = jest.spyOn(logger, "info");
actionMap.stopped();
expect(loggerInfo).lastCalledWith("The blockchain has been stopped :guitar:");
expect(loggerInfo).lastCalledWith("The blockchain has been stopped");
});
});

describe("exitApp", () => {
it("should call container forceExit with error message", () => {
const forceExit = jest.spyOn(container, "forceExit").mockImplementationOnce(() => null);
actionMap.exitApp();
expect(forceExit).lastCalledWith("Failed to startup blockchain. Exiting Ark Core! :rotating_light:");
expect(forceExit).lastCalledWith("Failed to startup blockchain. Exiting Ark Core!");
});
});

Expand Down Expand Up @@ -304,8 +304,8 @@ describe("State Machine", () => {

it("should verify database integrity if database recovery was not successful (!restoredDatabaseIntegrity)", async () => {
await expect(() => actionMap.init()).toDispatch(blockchain, "STARTED");
expect(loggerInfo).nthCalledWith(1, "Verifying database integrity :hourglass_flowing_sand:");
expect(loggerInfo).nthCalledWith(2, "Verified database integrity :smile_cat:");
expect(loggerInfo).nthCalledWith(1, "Verifying database integrity");
expect(loggerInfo).nthCalledWith(2, "Verified database integrity");
});

it("should dispatch ROLLBACK if database recovery was not successful and verifyBlockchain failed", async () => {
Expand All @@ -315,7 +315,7 @@ describe("State Machine", () => {
});

await expect(() => actionMap.init()).toDispatch(blockchain, "ROLLBACK");
expect(loggerError).nthCalledWith(1, "FATAL: The database is corrupted :fire:");
expect(loggerError).nthCalledWith(1, "FATAL: The database is corrupted");
});

it("should skip database integrity check if database recovery was successful (restoredDatabaseIntegrity)", async () => {
Expand All @@ -324,7 +324,7 @@ describe("State Machine", () => {
await expect(() => actionMap.init()).toDispatch(blockchain, "STARTED");
expect(loggerInfo).nthCalledWith(
1,
"Skipping database integrity check after successful database recovery :smile_cat:",
"Skipping database integrity check after successful database recovery",
);
});

Expand All @@ -347,7 +347,7 @@ describe("State Machine", () => {
await expect(() => actionMap.init()).toDispatch(blockchain, "STARTED");
expect(databaseMocks.buildWallets).toHaveBeenCalledWith(1);
expect(loggerVerbose).toHaveBeenCalledWith(
"TEST SUITE DETECTED! SYNCING WALLETS AND STARTING IMMEDIATELY. :bangbang:",
"TEST SUITE DETECTED! SYNCING WALLETS AND STARTING IMMEDIATELY.",
);
});

Expand Down Expand Up @@ -394,7 +394,7 @@ describe("State Machine", () => {

await expect(() => actionMap.init()).toDispatch(blockchain, "STARTED");
expect(loggerWarn).toHaveBeenCalledWith(
"Rebuilding wallets table because of some inconsistencies. Most likely due to an unfortunate shutdown. :hammer:",
"Rebuilding wallets table because of some inconsistencies. Most likely due to an unfortunate shutdown.",
);
expect(databaseMocks.saveWallets).toHaveBeenCalledWith(true);
});
Expand Down Expand Up @@ -553,7 +553,7 @@ describe("State Machine", () => {

actionMap.analyseFork();

expect(loggerInfo).toHaveBeenCalledWith("Analysing fork :mag:");
expect(loggerInfo).toHaveBeenCalledWith("Analysing fork");
});
});

Expand All @@ -575,7 +575,7 @@ describe("State Machine", () => {
];
await expect(() => actionMap.startForkRecovery()).toDispatch(blockchain, "SUCCESS");

expect(loggerInfo).toHaveBeenCalledWith("Starting fork recovery :fork_and_knife:");
expect(loggerInfo).toHaveBeenCalledWith("Starting fork recovery");
methodsCalled.forEach(method => {
expect(method).toHaveBeenCalled();
});
Expand Down Expand Up @@ -609,9 +609,7 @@ describe("State Machine", () => {

await expect(() => actionMap.rollbackDatabase()).toDispatch(blockchain, "SUCCESS");

expect(loggerInfo).toHaveBeenCalledWith(
"Database integrity verified again after rollback to height 1 :green_heart:",
);
expect(loggerInfo).toHaveBeenCalledWith("Database integrity verified again after rollback to height 1");
expect(removeTopBlocks).toHaveBeenCalledTimes(3); // because the 3rd time verifyBlockchain returned true
});

Expand All @@ -637,9 +635,7 @@ describe("State Machine", () => {

await expect(() => actionMap.rollbackDatabase()).toDispatch(blockchain, "FAILURE");

expect(loggerError).toHaveBeenCalledWith(
"FATAL: Failed to restore database integrity :skull: :skull: :skull:",
);
expect(loggerError).toHaveBeenCalledWith("FATAL: Failed to restore database integrity");
expect(removeTopBlocks).toHaveBeenCalledTimes(5); // because after 5 times we get past maxBlockRewind
});
});
Expand Down
18 changes: 9 additions & 9 deletions packages/core-blockchain/src/blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export class Blockchain implements blockchain.IBlockchain {

if (this.state.networkStart) {
logger.warn(
"Ark Core is launched in Genesis Start mode. This is usually for starting the first node on the blockchain. Unless you know what you are doing, this is likely wrong. :warning:",
"Ark Core is launched in Genesis Start mode. This is usually for starting the first node on the blockchain. Unless you know what you are doing, this is likely wrong.",
);
logger.info("Starting Ark Core for a new world, welcome aboard :rocket:");
logger.info("Starting Ark Core for a new world, welcome aboard");
}

this.actions = stateMachine.actionMap(this);
Expand Down Expand Up @@ -110,7 +110,7 @@ export class Blockchain implements blockchain.IBlockchain {
if (action) {
setTimeout(() => action.call(this, event), 0);
} else {
logger.error(`No action '${actionKey}' found :interrobang:`);
logger.error(`No action '${actionKey}' found`);
}
});

Expand Down Expand Up @@ -216,7 +216,7 @@ export class Blockchain implements blockchain.IBlockchain {
* Hand the given transactions to the transaction handler.
*/
public async postTransactions(transactions: Transaction[]) {
logger.info(`Received ${transactions.length} new ${pluralize("transaction", transactions.length)} :moneybag:`);
logger.info(`Received ${transactions.length} new ${pluralize("transaction", transactions.length)}`);

await this.transactionPool.addTransactions(transactions);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ export class Blockchain implements blockchain.IBlockchain {
this.dispatch("NEWBLOCK");
this.enqueueBlocks([block]);
} else {
logger.info(`Block disregarded because blockchain is not ready :exclamation:`);
logger.info(`Block disregarded because blockchain is not ready`);
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@ export class Blockchain implements blockchain.IBlockchain {
this.state.lastDownloadedBlock = newLastBlock;
};

logger.info(`Removing ${pluralize("block", height - newHeight, true)} to reset current round :warning:`);
logger.info(`Removing ${pluralize("block", height - newHeight, true)} to reset current round`);

let count = 0;
const max = this.state.getLastBlock().data.height - newHeight;
Expand Down Expand Up @@ -435,10 +435,10 @@ export class Blockchain implements blockchain.IBlockchain {
return callback();
}
this.state.lastDownloadedBlock = lastBlock;
logger.info(`Block ${block.data.height.toLocaleString()} disregarded because on a fork :knife_fork_plate:`);
logger.info(`Block ${block.data.height.toLocaleString()} disregarded because on a fork`);
return callback();
}
logger.warn(`Block ${block.data.height.toLocaleString()} disregarded because verification failed :scroll:`);
logger.warn(`Block ${block.data.height.toLocaleString()} disregarded because verification failed`);
logger.warn(JSON.stringify(block.verification, null, 4));
return callback();
}
Expand Down Expand Up @@ -529,7 +529,7 @@ export class Blockchain implements blockchain.IBlockchain {
block = block || this.getLastBlock();

const remaining = slots.getTime() - block.data.timestamp;
logger.info(`Remaining block timestamp ${remaining} :hourglass:`);
logger.info(`Remaining block timestamp ${remaining}`);

// stop fast rebuild 7 days before the last network block
return slots.getTime() - block.data.timestamp < 3600 * 24 * 7;
Expand Down
Loading