mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-24 22:33:52 +03:00
GH-260 Use neovim's logging facilities in NeoVimServer
This commit is contained in:
parent
84bd52bf17
commit
1c9ccf6e28
19
NeoVimServer/CocoaCategories.h
Normal file
19
NeoVimServer/CocoaCategories.h
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSObject (NeoVimServer)
|
||||
|
||||
@property (readonly, nonnull) const char *cdesc;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSString (NeoVimServer)
|
||||
|
||||
@property (readonly, nonnull) const char *cstr;
|
||||
|
||||
@end
|
22
NeoVimServer/CocoaCategories.m
Normal file
22
NeoVimServer/CocoaCategories.m
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
#import "CocoaCategories.h"
|
||||
|
||||
@implementation NSObject (NeoVimServer)
|
||||
|
||||
- (const char *)cdesc {
|
||||
return self.description.cstr;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSString (NeoVimServer)
|
||||
|
||||
- (const char *)cstr {
|
||||
return [self cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
@end
|
@ -3,35 +3,4 @@
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#ifndef log4Debug
|
||||
#define log4Debug(format, ...) printf("%s", [[NSString stringWithFormat:(@"[DEBUG] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Mark
|
||||
#define log4Mark printf("%s", [[NSString stringWithFormat:(@"%s %s %s - %d\n"), __TIME__, __FILE__, __PRETTY_FUNCTION__, __LINE__] UTF8String])
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define log4Debug(...)
|
||||
#define log4Mark
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef log4Info
|
||||
#define log4Info(format, ...) printf("%s", [[NSString stringWithFormat:(@"[INFO ] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Warn
|
||||
#define log4Warn(format, ...) printf("%s", [[NSString stringWithFormat:(@"[WARN ] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Error
|
||||
#define log4Error(format, ...) printf("%s", [[NSString stringWithFormat:(@"[ERROR] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Fatal
|
||||
#define log4Fatal(format, ...) printf("%s", [[NSString stringWithFormat:(@"[FATAL] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
#import <nvim/log.h>
|
||||
|
@ -6,6 +6,7 @@
|
||||
#import "NeoVimServer.h"
|
||||
#import "server_globals.h"
|
||||
#import "Logging.h"
|
||||
#import "CocoaCategories.h"
|
||||
|
||||
|
||||
// When #define'd you can execute the NeoVimServer binary and neovim will be started:
|
||||
@ -137,7 +138,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
#endif
|
||||
|
||||
if (_remoteServerPort == NULL) {
|
||||
log4Warn("Remote server is null: The msg (%lu:%@) could not be sent.", (unsigned long) msgid, data);
|
||||
WLOG("Remote server is null: The msg (%lu:%s) could not be sent.", (unsigned long) msgid, data.cdesc);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,7 +150,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
return;
|
||||
}
|
||||
|
||||
log4Warn("The msg (%lu:%@) could not be sent: %d", (unsigned long) msgid, data, responseCode);
|
||||
WLOG("The msg (%lu:%s) could not be sent: %d", (unsigned long) msgid, data.cdesc, responseCode);
|
||||
}
|
||||
|
||||
- (void)notifyReadiness {
|
||||
|
@ -7,6 +7,7 @@
|
||||
#import "NeoVimServer.h"
|
||||
#import "server_globals.h"
|
||||
#import "Logging.h"
|
||||
#import "CocoaCategories.h"
|
||||
#import <sys/event.h>
|
||||
#import <uv.h>
|
||||
|
||||
@ -34,7 +35,7 @@ static void observe_parent_termination(void *arg) {
|
||||
kevent(kq, &procEvent, 1, &procEvent, 1, 0);
|
||||
}
|
||||
|
||||
log4Debug("Exiting NeoVimServer - parent terminated.");
|
||||
DLOG("Exiting NeoVimServer: Parent terminated.");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -48,10 +49,12 @@ int main(int argc, const char *argv[]) {
|
||||
NSString *localServerName = arguments[2];
|
||||
|
||||
_neovim_server = [[NeoVimServer alloc] initWithLocalServerName:localServerName remoteServerName:remoteServerName];
|
||||
DLOG("Started neovim server '%s' and connected it with the remote agent '%s'.",
|
||||
localServerName.cstr, remoteServerName.cstr);
|
||||
|
||||
[_neovim_server notifyReadiness];
|
||||
}
|
||||
|
||||
CFRunLoopRun();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#import "NeoVimServer.h"
|
||||
#import "NeoVimUiBridgeProtocol.h"
|
||||
#import "NeoVimBuffer.h"
|
||||
#import "CocoaCategories.h"
|
||||
|
||||
// FileInfo and Boolean are #defined by Carbon and NeoVim: Since we don't need the Carbon versions of them, we rename
|
||||
// them.
|
||||
@ -283,7 +284,6 @@ static void server_ui_highlight_set(UI *ui __unused, HlAttrs attrs) {
|
||||
static void server_ui_put(UI *ui __unused, uint8_t *str, size_t len) {
|
||||
queue(^{
|
||||
NSString *string = [[NSString alloc] initWithBytes:str length:len encoding:NSUTF8StringEncoding];
|
||||
// printf("%s", [string cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
int cursor[] = { screen_cursor_row(), screen_cursor_column() };
|
||||
|
||||
NSMutableData *data = [[NSMutableData alloc]
|
||||
@ -292,13 +292,13 @@ static void server_ui_put(UI *ui __unused, uint8_t *str, size_t len) {
|
||||
[data appendData:[string dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
|
||||
if (_marked_text != nil && _marked_row == _put_row && _marked_column == _put_column) {
|
||||
// log4Debug("putting marked text: '%@'", string);
|
||||
DLOG("putting marked text: '%s'", string.cstr);
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdPutMarked data:data];
|
||||
} else if (_marked_text != nil && len == 0 && _marked_row == _put_row && _marked_column == _put_column - 1) {
|
||||
// log4Debug("putting marked text cuz zero");
|
||||
DLOG("putting marked text cuz zero");
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdPutMarked data:data];
|
||||
} else {
|
||||
// log4Debug("putting non-marked text: '%@'", string);
|
||||
DLOG("putting non-marked text: '%s'", string.cstr);
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdPut data:data];
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ static void neovim_command(void **argv) {
|
||||
|
||||
Error err;
|
||||
vim_command((String) {
|
||||
.data = (char *) [input cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
.data = (char *) input.cstr,
|
||||
.size = [input lengthOfBytesUsingEncoding:NSUTF8StringEncoding]
|
||||
}, &err);
|
||||
|
||||
@ -468,7 +468,7 @@ static void neovim_input(void **argv) {
|
||||
|
||||
// FIXME: check the length of the consumed bytes by neovim and if not fully consumed, call vim_input again.
|
||||
vim_input((String) {
|
||||
.data = (char *) [input cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
.data = (char *) input.cstr,
|
||||
.size = [input lengthOfBytesUsingEncoding:NSUTF8StringEncoding]
|
||||
});
|
||||
|
||||
@ -479,13 +479,13 @@ static void neovim_input(void **argv) {
|
||||
static void neovim_send_dirty_status(void **argv) {
|
||||
@autoreleasepool {
|
||||
bool new_dirty_status = server_has_dirty_docs();
|
||||
// log4Debug("dirty status: %d vs. %d", _dirty, new_dirty_status);
|
||||
DLOG("dirty status: %d vs. %d", _dirty, new_dirty_status);
|
||||
if (_dirty == new_dirty_status) {
|
||||
return;
|
||||
}
|
||||
|
||||
_dirty = new_dirty_status;
|
||||
// log4Debug("sending dirty status: %d", _dirty);
|
||||
DLOG("sending dirty status: %d", _dirty);
|
||||
NSData *data = [[NSData alloc] initWithBytes:&_dirty length:sizeof(bool)];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdDirtyStatusChanged data:data];
|
||||
[data release];
|
||||
@ -555,7 +555,7 @@ void custom_ui_start(void) {
|
||||
void custom_ui_autocmds_groups(
|
||||
event_T event, char_u *fname, char_u *fname_io, int group, bool force, buf_T *buf, exarg_T *eap
|
||||
) {
|
||||
// log4Debug("got event %d for file %s in group %d.", event, fname, group);
|
||||
DLOG("got event %d for file %s in group %d.", event, fname, group);
|
||||
switch (event) {
|
||||
// Did we get them all?
|
||||
case EVENT_TEXTCHANGED:
|
||||
@ -583,7 +583,7 @@ void server_start_neovim() {
|
||||
uv_cond_init(&_condition);
|
||||
|
||||
uv_thread_create(&_nvim_thread, run_neovim, NULL);
|
||||
log4Debug("NeoVim started");
|
||||
DLOG("NeoVim started");
|
||||
|
||||
// continue only after our UI main code for neovim has been fully initialized
|
||||
uv_mutex_lock(&_mutex);
|
||||
@ -623,7 +623,7 @@ void server_delete(NSInteger count) {
|
||||
}
|
||||
}
|
||||
|
||||
// log4Debug("put cursor: %d:%d, count: %li, delta: %d", _put_row, _put_column, count, _marked_delta);
|
||||
DLOG("put cursor: %d:%d, count: %li, delta: %d", _put_row, _put_column, count, _marked_delta);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
loop_schedule(&main_loop, event_create(1, neovim_input, 1, [_backspace retain])); // release in neovim_input
|
||||
@ -655,11 +655,11 @@ void server_vim_input(NSString *input) {
|
||||
// inserted. Neovim's drawing code is optimized such that it does not call put in this case again, thus, we have
|
||||
// to manually unmark the cells in the main app.
|
||||
if ([_marked_text isEqualToString:input]) {
|
||||
// log4Debug("unmarking text: '%@'\t now at %d:%d", input, _put_row, _put_column);
|
||||
const char *str = [_marked_text cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
DLOG("unmarking text: '%s'\t now at %d:%d", input.cstr, _put_row, _put_column);
|
||||
const char *str = _marked_text.cstr;
|
||||
size_t cellCount = mb_string2cells((const char_u *) str);
|
||||
for (int i = 1; i <= cellCount; i++) {
|
||||
// log4Debug("unmarking at %d:%d", _put_row, _put_column - i);
|
||||
DLOG("unmarking at %d:%d", _put_row, _put_column - i);
|
||||
int values[] = { _put_row, MAX(_put_column - i, 0) };
|
||||
NSData *data = [[NSData alloc] initWithBytes:values length:(2 * sizeof(int))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdUnmark data:data];
|
||||
@ -677,13 +677,13 @@ void server_vim_input_marked_text(NSString *markedText) {
|
||||
if (_marked_text == nil) {
|
||||
_marked_row = _put_row;
|
||||
_marked_column = _put_column + _marked_delta;
|
||||
// log4Debug("marking position: %d:%d(%d + %d)", _put_row, _marked_column, _put_column, _marked_delta);
|
||||
DLOG("marking position: %d:%d(%d + %d)", _put_row, _marked_column, _put_column, _marked_delta);
|
||||
_marked_delta = 0;
|
||||
} else {
|
||||
delete_marked_text();
|
||||
}
|
||||
|
||||
// log4Debug("inserting marked text '%@' at %d:%d", markedText, _put_row, _put_column);
|
||||
DLOG("inserting marked text '%s' at %d:%d", markedText.cstr, _put_row, _put_column);
|
||||
insert_marked_text(markedText);
|
||||
});
|
||||
}
|
||||
@ -735,6 +735,6 @@ NSArray *server_buffers() {
|
||||
}
|
||||
|
||||
void server_quit() {
|
||||
log4Debug("NeoVimServer exiting...");
|
||||
DLOG("NeoVimServer exiting...");
|
||||
exit(0);
|
||||
}
|
||||
|
@ -8,11 +8,13 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1929B165820D7177743B537A /* Component.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B39DA7AC4A9B62D7CD39 /* Component.swift */; };
|
||||
1929B1E05C116514C1D3A384 /* CocoaCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B5C3F2F1CA4113DABFFD /* CocoaCategories.m */; };
|
||||
1929B728262BAA14FC93F6AC /* NeoVimView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BF00B466B40629C2AABE /* NeoVimView.swift */; };
|
||||
1929B93DBAD09835E428F610 /* PrefPane.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB251F74BEFC82CEEF84 /* PrefPane.swift */; };
|
||||
1929BEB90DCDAF7A2B68C886 /* ColorUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BA6128BFDD54CA92F46E /* ColorUtils.swift */; };
|
||||
1929BF81A40B4154D3EA33CE /* server_ui.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B93013228985F509C8F6 /* server_ui.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
4B029F1A1D45E349004EE0D3 /* PrefWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B029F1C1D45E349004EE0D3 /* PrefWindow.xib */; };
|
||||
4B0BCC941D70320C00D3CE65 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B0BCC931D70320C00D3CE65 /* Logging.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
4B0C905B1D5DED69007753A3 /* NeoVimBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B0C905A1D5DED69007753A3 /* NeoVimBuffer.m */; };
|
||||
4B0E22581D5DEDC700C072E6 /* NeoVimBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B0C90591D5DED69007753A3 /* NeoVimBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4B0E22591D5DF62E00C072E6 /* NeoVimBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B0C905A1D5DED69007753A3 /* NeoVimBuffer.m */; };
|
||||
@ -173,13 +175,17 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1929B15B7EDC9B0F40E5E95C /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
|
||||
1929B1A51F076E088EF4CCA4 /* server_globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = server_globals.h; sourceTree = "<group>"; };
|
||||
1929B39DA7AC4A9B62D7CD39 /* Component.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Component.swift; sourceTree = "<group>"; };
|
||||
1929B5C3F2F1CA4113DABFFD /* CocoaCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocoaCategories.m; sourceTree = "<group>"; };
|
||||
1929B93013228985F509C8F6 /* server_ui.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = server_ui.m; sourceTree = "<group>"; };
|
||||
1929BA6128BFDD54CA92F46E /* ColorUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorUtils.swift; sourceTree = "<group>"; };
|
||||
1929BB251F74BEFC82CEEF84 /* PrefPane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrefPane.swift; sourceTree = "<group>"; };
|
||||
1929BE69CF9AB1A10D0DD4F2 /* CocoaCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoaCategories.h; sourceTree = "<group>"; };
|
||||
1929BF00B466B40629C2AABE /* NeoVimView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NeoVimView.swift; sourceTree = "<group>"; };
|
||||
4B029F1B1D45E349004EE0D3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PrefWindow.xib; sourceTree = "<group>"; };
|
||||
4B0BCC931D70320C00D3CE65 /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = VimR/Logging.h; sourceTree = SOURCE_ROOT; };
|
||||
4B0C90591D5DED69007753A3 /* NeoVimBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NeoVimBuffer.h; sourceTree = "<group>"; };
|
||||
4B0C905A1D5DED69007753A3 /* NeoVimBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NeoVimBuffer.m; sourceTree = "<group>"; };
|
||||
4B1BB3521D16C5E500CA4FEF /* InputTestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputTestView.swift; sourceTree = "<group>"; };
|
||||
@ -210,7 +216,6 @@
|
||||
4B6A70931D60E04200E12030 /* CocoaExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CocoaExtensions.swift; sourceTree = "<group>"; };
|
||||
4B6A70951D6100E300E12030 /* SwiftCommons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftCommons.swift; sourceTree = "<group>"; };
|
||||
4B6A709E1D660CDA00E12030 /* ShellUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShellUtils.swift; sourceTree = "<group>"; };
|
||||
4B7BD3321D32530900AAA45E /* Logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
|
||||
4B854A1A1D31447C00E08DE1 /* NeoVimServer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = NeoVimServer; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4B854A1C1D31447C00E08DE1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
4B97E2CD1D33F53D00FC0660 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = "<group>"; };
|
||||
@ -376,7 +381,6 @@
|
||||
children = (
|
||||
4BCF638F1D323CFD00F15CE4 /* nvim */,
|
||||
4BDCFADC1D3145EA00F62670 /* lib */,
|
||||
4B7BD3321D32530900AAA45E /* Logging.h */,
|
||||
4BDCFAE91D3147A300F62670 /* NeoVimMsgIds.h */,
|
||||
4B0C90591D5DED69007753A3 /* NeoVimBuffer.h */,
|
||||
4B0C905A1D5DED69007753A3 /* NeoVimBuffer.m */,
|
||||
@ -385,6 +389,9 @@
|
||||
4B854A1C1D31447C00E08DE1 /* main.m */,
|
||||
1929B93013228985F509C8F6 /* server_ui.m */,
|
||||
1929B1A51F076E088EF4CCA4 /* server_globals.h */,
|
||||
1929B15B7EDC9B0F40E5E95C /* Logging.h */,
|
||||
1929B5C3F2F1CA4113DABFFD /* CocoaCategories.m */,
|
||||
1929BE69CF9AB1A10D0DD4F2 /* CocoaCategories.h */,
|
||||
);
|
||||
path = NeoVimServer;
|
||||
sourceTree = "<group>";
|
||||
@ -473,6 +480,7 @@
|
||||
4BEE79131D16D1C60012EDAA /* NeoVimView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4B0BCC931D70320C00D3CE65 /* Logging.h */,
|
||||
1929BF00B466B40629C2AABE /* NeoVimView.swift */,
|
||||
4B401B191D046E0600D99EDC /* NeoVimViewDelegate.swift */,
|
||||
4B570DC01D303CAF006EDC21 /* NeoVimAgent.h */,
|
||||
@ -495,6 +503,7 @@
|
||||
4B0E22581D5DEDC700C072E6 /* NeoVimBuffer.h in Headers */,
|
||||
4BDCFAEA1D31486E00F62670 /* NeoVimMsgIds.h in Headers */,
|
||||
4B2A2BFA1D0351810074CE9A /* SwiftNeoVim.h in Headers */,
|
||||
4B0BCC941D70320C00D3CE65 /* Logging.h in Headers */,
|
||||
4BDF64241D08CAB000D47E1D /* MMCoreTextView.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -740,6 +749,7 @@
|
||||
4B854A1D1D31447C00E08DE1 /* main.m in Sources */,
|
||||
1929BF81A40B4154D3EA33CE /* server_ui.m in Sources */,
|
||||
4B0C905B1D5DED69007753A3 /* NeoVimBuffer.m in Sources */,
|
||||
1929B1E05C116514C1D3A384 /* CocoaCategories.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
37
VimR/Logging.h
Normal file
37
VimR/Logging.h
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#ifndef log4Debug
|
||||
#define log4Debug(format, ...) printf("%s", [[NSString stringWithFormat:(@"[DEBUG] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Mark
|
||||
#define log4Mark printf("%s", [[NSString stringWithFormat:(@"%s %s %s - %d\n"), __TIME__, __FILE__, __PRETTY_FUNCTION__, __LINE__] UTF8String])
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define log4Debug(...)
|
||||
#define log4Mark
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef log4Info
|
||||
#define log4Info(format, ...) printf("%s", [[NSString stringWithFormat:(@"[INFO ] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Warn
|
||||
#define log4Warn(format, ...) printf("%s", [[NSString stringWithFormat:(@"[WARN ] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Error
|
||||
#define log4Error(format, ...) printf("%s", [[NSString stringWithFormat:(@"[ERROR] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
||||
|
||||
#ifndef log4Fatal
|
||||
#define log4Fatal(format, ...) printf("%s", [[NSString stringWithFormat:(@"[FATAL] %s %@ %s - %d: " format "\n"), __TIME__, [[NSString stringWithUTF8String: __FILE__] lastPathComponent], __func__, __LINE__, ##__VA_ARGS__] UTF8String])
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user