@sebspark/otel 1.0.4 → 1.0.5

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.
package/dist/index.js CHANGED
@@ -749,14 +749,18 @@ var getResource = async () => {
749
749
  import_api3.diag.disable();
750
750
  import_api3.diag.setLogger(new import_api3.DiagConsoleLogger(), import_api3.DiagLogLevel.ERROR);
751
751
  var initialization;
752
+ var _isInitialized = false;
752
753
  async function initialize(...instrumentations2) {
753
754
  if (!initialization) {
754
755
  initialization = _initialize(instrumentations2);
756
+ initialization.then(() => {
757
+ _isInitialized = true;
758
+ });
755
759
  }
756
760
  return initialization;
757
761
  }
758
762
  function isInitialized() {
759
- return !!initialization;
763
+ return _isInitialized;
760
764
  }
761
765
  async function _initialize(instrumentations2) {
762
766
  try {
@@ -800,6 +804,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
800
804
  function emit(severityText, body, attrs = {}) {
801
805
  if (!isInitialized()) {
802
806
  console.warn("OTEL must be initialized before using logger");
807
+ console.log(`[${severityText}] ${body}`);
803
808
  return;
804
809
  }
805
810
  const logger = import_api_logs3.logs.getLogger(systemName, systemVersion);
package/dist/index.mjs CHANGED
@@ -734,14 +734,18 @@ var getResource = async () => {
734
734
  diag.disable();
735
735
  diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);
736
736
  var initialization;
737
+ var _isInitialized = false;
737
738
  async function initialize(...instrumentations2) {
738
739
  if (!initialization) {
739
740
  initialization = _initialize(instrumentations2);
741
+ initialization.then(() => {
742
+ _isInitialized = true;
743
+ });
740
744
  }
741
745
  return initialization;
742
746
  }
743
747
  function isInitialized() {
744
- return !!initialization;
748
+ return _isInitialized;
745
749
  }
746
750
  async function _initialize(instrumentations2) {
747
751
  try {
@@ -785,6 +789,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
785
789
  function emit(severityText, body, attrs = {}) {
786
790
  if (!isInitialized()) {
787
791
  console.warn("OTEL must be initialized before using logger");
792
+ console.log(`[${severityText}] ${body}`);
788
793
  return;
789
794
  }
790
795
  const logger = logs2.getLogger(systemName, systemVersion);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebspark/otel",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",