@cenk1cenk2/oclif-common 3.4.1 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,13 +66,15 @@ var Logger = class {
66
66
  constructor(context, options) {
67
67
  this.context = context;
68
68
  this.options = options;
69
- const level = options?.level?.toUpperCase();
69
+ const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */;
70
+ const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
70
71
  this.options = {
71
72
  useIcons: true,
72
73
  ...options,
73
- level: Object.values(LogLevels).includes(level) ? level : "INFO" /* INFO */
74
+ level
74
75
  };
75
76
  if (Logger.instance) {
77
+ Logger.instance.level = level;
76
78
  this.logger = Logger.instance;
77
79
  } else {
78
80
  this.logger = this.initiateLogger();
@@ -62,13 +62,15 @@ var Logger = class {
62
62
  constructor(context, options) {
63
63
  this.context = context;
64
64
  this.options = options;
65
- const level = options?.level?.toUpperCase();
65
+ const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */;
66
+ const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
66
67
  this.options = {
67
68
  useIcons: true,
68
69
  ...options,
69
- level: Object.values(LogLevels).includes(level) ? level : "INFO" /* INFO */
70
+ level
70
71
  };
71
72
  if (Logger.instance) {
73
+ Logger.instance.level = level;
72
74
  this.logger = Logger.instance;
73
75
  } else {
74
76
  this.logger = this.initiateLogger();
@@ -65,13 +65,15 @@ var Logger = class {
65
65
  constructor(context, options) {
66
66
  this.context = context;
67
67
  this.options = options;
68
- const level = options?.level?.toUpperCase();
68
+ const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */;
69
+ const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
69
70
  this.options = {
70
71
  useIcons: true,
71
72
  ...options,
72
- level: Object.values(LogLevels).includes(level) ? level : "INFO" /* INFO */
73
+ level
73
74
  };
74
75
  if (Logger.instance) {
76
+ Logger.instance.level = level;
75
77
  this.logger = Logger.instance;
76
78
  } else {
77
79
  this.logger = this.initiateLogger();
package/dist/index.js CHANGED
@@ -120,13 +120,15 @@ var Logger = class {
120
120
  constructor(context, options) {
121
121
  this.context = context;
122
122
  this.options = options;
123
- const level = options?.level?.toUpperCase();
123
+ const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */;
124
+ const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
124
125
  this.options = {
125
126
  useIcons: true,
126
127
  ...options,
127
- level: Object.values(LogLevels).includes(level) ? level : "INFO" /* INFO */
128
+ level
128
129
  };
129
130
  if (Logger.instance) {
131
+ Logger.instance.level = level;
130
132
  this.logger = Logger.instance;
131
133
  } else {
132
134
  this.logger = this.initiateLogger();
@@ -1072,17 +1074,12 @@ var Command = class extends import_core2.Command {
1072
1074
  return this.tasks.runAll();
1073
1075
  }
1074
1076
  prompt(options) {
1075
- try {
1076
- return (0, import_listr23.createPrompt)(options, {
1077
- stdout: process.stdout,
1078
- cancelCallback: () => {
1079
- throw new Error("Cancelled prompt.");
1080
- }
1081
- });
1082
- } catch (e) {
1083
- this.logger.fatal("There was a problem getting the answer of the last question.");
1084
- throw e;
1085
- }
1077
+ return (0, import_listr23.createPrompt)(options, {
1078
+ stdout: process.stdout,
1079
+ cancelCallback: () => {
1080
+ throw new Error("Cancelled prompt.");
1081
+ }
1082
+ });
1086
1083
  }
1087
1084
  setCtxDefaults(...defaults) {
1088
1085
  return setCtxDefaults(this.tasks.options.ctx, ...defaults);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "3.4.1",
3
+ "version": "3.4.3",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "author": {