Comments (4)
I got the same error while building a typescript application. Node:18:14:2, TSC: 5.3.2. MacOS
from tslog.
Same issue here using a custom logger this would be nice to fix!
from tslog.
Is it possible, that you have some circular dependencies somewhere? So basically, in the file where you create the root logger to the file where you try to create or consume a sub logger? Have you tried importing tslog instanciating the logger in the same file, where you replaced that logger with console.log? Because effectively it’s exactly what you did by placing console.log inside, since you instanciate it right there without importing a sub logger.
We once ran into a similar problem with tRPC and assumed tslog was the problem, it turned out to be a circular dependency and a Node problem indeed.
If that’s not the case, can you provide me with a repo, that boils down the problem for reproduction? Thx
from tslog.
I can't share the full code but I'm not really doing any import magic.
This is my logging config:
import { Logger, ILogObj, ISettingsParam } from 'tslog';
const prettyLogConfig: ISettingsParam<ILogObj> = {...};
const structuredLogConfig: ISettingsParam<ILogObj> = {...};
const formattedLogging: boolean = ['0', 'off', 'false', 'no'].includes(
String(process.env?.STRUCTURED_LOGS).toLowerCase()
);
const logger: Logger<ILogObj> = new Logger(
formattedLogging ? prettyLogConfig : structuredLogConfig
);
export { logger };
Then I use it like this:
import { logger } from './logging.js';
...
const objects: MyCustomObject[] = await getMyCustomObjects(getMyCustomObjectsRequest);
console.log(`List objects (console)`, objects);
logger.info(`List objects (logger)`, objects);
from tslog.
Related Issues (20)
- Question about filepaths HOT 1
- Bug: [BUG]mongodb 4.0.3 shard duplicate key error log failed HOT 3
- Bug: Build output not respecting file extensions in import statements HOT 2
- Feature Request: please bring back log level name constructor where minLevel takes a string
- Bug: "hostname" is not exported by "__vite-browser-external", HOT 11
- Documentation: README.md suggest a broken way to extend `BaseLogger` HOT 7
- Feature Request: [Type the json param of the transportJSON function]
- Customizing field names for arguments using `type:json` HOT 1
- Bug: [BUG] Getting Control Characters in browser (FF and Chrome) HOT 3
- Feature Request: Print objects to console without expanding them. HOT 2
- Feature Request: [Feature] HOT 4
- Bug: [BUG] Inspect Polyfill Does Not Gracefully Handle Invalid Dates HOT 3
- Question - CommonJS with TypeScript 5.x and tslog HOT 3
- Bug: interface is missing optional hostname HOT 2
- Bug: TypeError when logging GraphQLError
- Tauri Webview do not show a correct format HOT 2
- Bug: Custom logger report calls from customer logger file HOT 1
- Bug: Error logging with [email protected] has issues HOT 1
- Feature Request: [Feature] How to inject extra info to the logs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tslog.