mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	feat(script): api.log now supports objects
This commit is contained in:
		| @@ -10,3 +10,4 @@ export * from "./lib/server_api.js"; | ||||
| export * from "./lib/shared_constants.js"; | ||||
| export * from "./lib/ws_api.js"; | ||||
| export * from "./lib/attribute_names.js"; | ||||
| export * from "./lib/utils.js"; | ||||
|   | ||||
							
								
								
									
										11
									
								
								packages/commons/src/lib/utils.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								packages/commons/src/lib/utils.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| export function formatLogMessage(message: string | object) { | ||||
|     if (typeof message === "object") { | ||||
|         try { | ||||
|             return JSON.stringify(message, null, 4); | ||||
|         } catch (e) { | ||||
|             return message.toString(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     return message; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user