Skip to content

Commit

Permalink
Merge pull request #27 from Chia-Network/develop
Browse files Browse the repository at this point in the history
release: 1.0.11
  • Loading branch information
MichaelTaylor3D authored Sep 25, 2023
2 parents 426c838 + 547b0ea commit 926dc9f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 19 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,30 @@ const fs = require("fs");
class Logger {
/**
* @param {Object} options - Logger options
* @param {string} options.namespace - The Chia namespace for this project
* @param {string} options.projectName - The name of the project using the logger.
* @param {string} options.logLevel - The logging level.
* @param {string} options.packageVersion - The version of the package.
*/
constructor(options) {
const { projectName, logLevel, packageVersion } = options;
const { namespace, projectName, logLevel, packageVersion } = options;

if (!namespace) {
throw new Error("options.namespace is required");
}

if (!projectName) {
throw new Error("options.projectName is required");
}

if (!logLevel) {
throw new Error("options.logLevel is required");
}

if (!packageVersion) {
throw new Error("options.packageVersion is required");
}

const customLevels = {
levels: {
fatal: 0,
Expand All @@ -44,7 +61,7 @@ class Logger {
addColors(customLevels.colors);

const chiaRoot = getChiaRoot();
const logDir = `${chiaRoot}/core-registry/logs/${projectName}`;
const logDir = `${chiaRoot}/${namespace}/logs/${projectName}`;

if (!fs.existsSync(logDir)) {
fs.mkdirSync(logDir, { recursive: true });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chia-carbon/core-registry-logger",
"version": "1.0.10",
"version": "1.0.11",
"description": "Custom logger for core registry projects",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 926dc9f

Please sign in to comment.